Chapter 8 Flashcards
sequential order
in order based on alphabet or numbers
Ascending/Descending
arranging from A-Z or lowest to highest
arranging from Z-A or highest to lowest
median value in a list
middle item in a list
what is ASCII, UNICODE, or EBCDIC
coding schemes that translate letters into numbers
algorithm
list of instructions that accomplish a task
bubble sort (sinking sort)
items in list are compared with each other in pairs and then swapped based on what is larger or smaller
in a bubble sort algorithm(sinking sort) , ascending sorts put the ____ and descending sorts put the ___
smallest item on top so the largest item sinks to the bottom
larger item on top so the smallest item sinks to the bottom
what does it mean to swap the values of two variables
to exchange their values with each other
what is the issue with swapping values
Ex:
score1 = 90
score 2= 85
If you do score2 = score1, the 85 value is lost. To fix this, create a temporary variable
temp = score2
score2 = score1
score1 = temp
what are the general rules of the bubble sort in terms of the number of pair comparisons
the number of pair comparisons is one less than the number of elements in the array
If you are performing an ascending sort, after you have made on pass through the list, what is guaranteed
the largest value is in its correct final position
What do you want to do to the comparisons on each pass through the array
stop the comparisons one element sooner
What is the insertion sort algorithm
it looks at each element one at a time, it moves each earlier item down one
what is the selection sort algorithm
it uses two sublists containing values already sorted and values not yet sorted
it repeatedly looks for the smallest value in the unsorted sublist and swap it with the item at the beginning then add that element to the end of the sorted sublist
what does a multidimensional array require
more than one subscript
a two dimensional array contains ____ and gets the location of any element dependent on _____ factors
two dimensions: hNint and width
two
each element in a two dimensional array requires two subscripts to reference it?
What are these subscript called
row and column
to declare a two dimensional array, you
type two sets of brackets after array type and name
the first bracket holds the number of rows
the second bracket holds the number of columns
in an array subscript for a two dimensional array, what does the first and second subscript represent
first represents the row
second represents the column
another words for a two-dimensional array is
matrix or table