Data Structuers and Functions Flashcards
What are the two ways of collecting data items together?
Giving collection a name
Accessing the items individually or as a collection
What is a named collection of homogeneous items in which individual items are accessed by their place within the collection?
Array
What is the place within a collection?
Index
Where do most programming start?
They start a 0
What is the result of this code?
Integer numbers [10]
//Declares numbers to hold 10 integer values
Write “Enter 10 integer numbers, one per line”
Set Position to 0// set variable positions to 0
WHILE (position < 10)
Read in numbers [position]
Set position to position + 1
//continue with processing
Algorithm to put values into the places in an array
What is a heterogeneous group of items where individuals items are accessed by name?
A record
What can a record collection contain?
Integers, real values, strings or any other type of data
What are records a good choice for?
Bundling items together that relate to the same object
What looks at each item in turn and compares it to the one for which we are searching. If it matches, we have found the item. If not, we look at the next item?
Sequential Search
What are special Boolean operations?
AND, OR, and NOT
What is a binary search?
Look for an item in an array using a different strategy
What strategies does a binary search use?
Divide and conquer!
what is a selection sort?
It mirrors how we sort a list of values if we had to do it by hand
What operator returns true if both expressions are true and false otherwise?
AND operator
What operator returns false if both expressions are false and true otherwise?
OR operator
What operator changes the values of the expression?
NOT operator
What stops looking when we pass the place where it would be if it were present in the array?
Sequential search in a Sorted Array
What search type can use divide and conquer?
Binary search
True or False
In a binary search, it starts from the first point and then moves its way down the list, pushing things into the right order.
False
A binary seach beings in the middle of the array. If item is less than t
What sorts similarly as we would cards in a deck? As it starts the sort, it will move cards in order as it goes through the deck and moves it into the right spot as it gets to the next card.
Selection sort
What starts at the end of the array, swapping the items whenever the bottom element of the pair in smaller than the one above it?
Bubble Sort
What algorithm is the easiest to use?
Selection Sort
What sorts “bubbling up”? Swapping the inserted item into the correct spot?
Insert sort
What is a container whose properties (data and operations) are specified independently of any particular implementation?
Abstract Data type (ADT)