Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double[] array1 = new double[10]
- |declares array1 to be an array of doubles, 10 values and subscripts of 1-9
- long[]
- |returns an array of long values from a method
- int [][] points = new int[10][20];
- |Creates 10 rows, 20 columns
- [2][3] row col
- |row = horizontal, column = vertical.
- numbers[r].length
- |Gives the length of row r
- public static void passArray(int [ ][ ] intArray)
- |The correct method header for a 2d array argument
- What is a Ragged Array
- | a 2d array when the rows are different lengths.
- final int SIZE = 15 and int[] x = new int[SIZE]
- |the range of subscript values is 0-14.
- Are Objects in an array accessed with Subscripts?
- |Yes
- What is a valid declaration for a ragged array, after which you would declare each row.
- | int[][] ragged = new int[5][];
- |The Binary search algorithm can not be used on an array thats not sorted.
- |A search for an item X in an array starts at the lower end, then looks for X by comparing items to X in an increasing subscript. This is a Sequential search.
- |A search for an item X in a portion of a sorted array works by repeatedly selecting the middle item and comparing it to X. This is a Binary Search
- To compare string objects,
- |You must use the compareTo method.
- --The bubble sort works by COMPARING adjacent items
- --the insertion sort works by TAKING the first value and placing it at the array thats already sorted.
- --the selection sort works by LOCATING the smallest value in the unsorted array and moving toward the lower end.
- --the quicksort works by PARTITIONING the unsorted potion and pivots into sublists.
- |Quicksort can be terminated by making too many recursive calls.
- An array of 4 elements is being sorted by insertion sort, how many comparisons will it take.
- | 6
- On the average, a sequential serach will require
- |N/2 Commmparsions
- The most ammount of comparisons Binary will ever need to make
- |The smallest integer k such that 2^k is larger or equal to N
- The 2 most important criteria for a sorting algorithm
- |Space and Time.
- If an algorithmm with an input size of n has a nested loop and both loops make a complete pass over the input
- |The performance would be quadratic time.
- If an algorithmm makes 2 seperate unnested passes over an input
- |The performance would be O(n)
- The position of an item in a list is called its index.
- The size of an arraylist
- |Is based on the number of elements in the list.
- The difference between an array and ArrayList is
- |An ArrayList uses a linked list to hold its elements.
- An arraylist is so called because
- |You can use array subscript notation to work with the arraylist.
- When elements are added to an ArrayList,
- |Theyre moved to the end.
- boolena contains(E element) search uses
- |Sequential search to locate the element.
- The int indexOf method
- |Searches a list for the occurrence of an object and returns its index.
- One advantage of generics is
- |More type problems can be uncovered at compile time.
- The automatic conversion of a primitive type to a wrapper type is called
- |Autoboxing.
- An advantage of using generic types is
- |Increased Type-safety.
- Constraining a type parameter in a generic class
- |Restricts the types that can be used
- The Java notation MyClass<Student> means that
- |MyClass is a generic class
- Automatic conversion of a wrapper type to a primitive type
- |Unboxing
- When a generic class is made without specifying a type argument, its a
- |Raw Type
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement