Flashcards
CSE 110 Lecture 20, 21 Notes
Cards in this deck (28)
- 1an object to store a list of dataArray
- 2this type of data can be saved as an array (not allowed to store different type data)Any Type (Primitive/Object)
- 3declaration of an array myArray of integer typeint[] myArray;
- 4initialization of an array myArray of integer type, size of 10myArray = new int[10];
- 5used to assign values to an arrayFor Loop
- 6used only for arrayBrackets []
- 7goes inside [] when referring to a value inside an arrayArray Index Number
- 8starts at 0Array Index
- 9used to find the length of an array myArraymyArray.length
- 10standard version of an enhanced for loop using variables element of type double and valuesfor (double element : values)
- 11used to search for an element until it is found; once the element is found, the search should be stoppedLinear/Sequential Search
- 12not an array object but a utility class for a list of objects similar to Math classArrays
- 13used to print out all elements of an array myArrayArrays.toString(myArray)
- 14used to sort the elements of an array myArrayArrays.sort(myArray)
- 15used to make a copy of an array myArray with an integer length lengthArrays.copyOf(myArray, length)
- 16an array that has both used and unused elementsPartially Filled Array
- 17a gap in an array; should be avoidedHole
- 18keep this as least as possible to save timeUpdate of Array Size
- 19search method that only works for a sorted arrayBinary Search
- 20when utilizing the binary search technique, this must be compared to the target valueMiddle Element
- 21binary search technique (short response)If the middle element is lower, exclude the lower half. If the middle element is higher, exclude the higher half. Repeat this process until the target is found.
- 22an object to store a list of objects (not primitives); dynamic (can grow and shrink); common array operations are built-inArrayList
- 23function of ArrayList to add an element a at the endvoid add(Object a)
- 24function of ArrayList to insert an element a at the position posvoid add(int pos, Object a)
- 25function of ArrayList to get the element at the given position pos (example is of int type)int get(int pos)
- 26function of ArrayList to set an element a at the position posvoid set(int pos, Object a)
- 27function of ArrayList to return the current lengthint size()
- 28function of ArrayList to delete an element at the given position posvoid remove(int pos)
Information
- Description
- CSE 110 (Notes) Flashcards on CSE 110 Lecture 20, 21 Notes, created by Branden Roper on 13/11/2017.
- Created by
- Branden Roper
- Views
- 1
- Tags
- Rating