Advertisement
Pearl2hu

Untitled

Oct 30th, 2019
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. double[] array1 = new double[10]
  2.  
  3. |declares array1 to be an array of doubles, 10 values and subscripts of 1-9
  4.  
  5. long[]
  6.  
  7. |returns an array of long values from a method
  8.  
  9. int [][] points = new int[10][20];
  10.  
  11. |Creates 10 rows, 20 columns
  12.  
  13. [2][3] row col
  14.  
  15. |row = horizontal, column = vertical.
  16.  
  17. numbers[r].length
  18.  
  19. |Gives the length of row r
  20.  
  21. public static void passArray(int [ ][ ] intArray)
  22.  
  23. |The correct method header for a 2d array argument
  24.  
  25. What is a Ragged Array
  26.  
  27. | a 2d array when the rows are different lengths.
  28.  
  29. final int SIZE = 15 and int[] x = new int[SIZE]
  30.  
  31. |the range of subscript values is 0-14.
  32.  
  33. Are Objects in an array accessed with Subscripts?
  34.  
  35. |Yes
  36.  
  37. What is a valid declaration for a ragged array, after which you would declare each row.
  38.  
  39. | int[][] ragged = new int[5][];
  40.  
  41. |The Binary search algorithm can not be used on an array thats not sorted.
  42.  
  43. |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.
  44.  
  45. |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
  46.  
  47. To compare string objects,
  48.  
  49. |You must use the compareTo method.
  50.  
  51. --The bubble sort works by COMPARING adjacent items
  52.  
  53. --the insertion sort works by TAKING the first value and placing it at the array thats already sorted.
  54.  
  55. --the selection sort works by LOCATING the smallest value in the unsorted array and moving toward the lower end.
  56.  
  57. --the quicksort works by PARTITIONING the unsorted potion and pivots into sublists.
  58.  
  59. |Quicksort can be terminated by making too many recursive calls.
  60.  
  61. An array of 4 elements is being sorted by insertion sort, how many comparisons will it take.
  62.  
  63. | 6
  64.  
  65. On the average, a sequential serach will require
  66.  
  67. |N/2 Commmparsions
  68.  
  69. The most ammount of comparisons Binary will ever need to make
  70.  
  71. |The smallest integer k such that 2^k is larger or equal to N
  72.  
  73. The 2 most important criteria for a sorting algorithm
  74.  
  75. |Space and Time.
  76.  
  77. If an algorithmm with an input size of n has a nested loop and both loops make a complete pass over the input
  78.  
  79. |The performance would be quadratic time.
  80.  
  81. If an algorithmm makes 2 seperate unnested passes over an input
  82.  
  83. |The performance would be O(n)
  84.  
  85. The position of an item in a list is called its index.
  86.  
  87. The size of an arraylist
  88.  
  89. |Is based on the number of elements in the list.
  90.  
  91. The difference between an array and ArrayList is
  92.  
  93. |An ArrayList uses a linked list to hold its elements.
  94.  
  95. An arraylist is so called because
  96.  
  97. |You can use array subscript notation to work with the arraylist.
  98.  
  99. When elements are added to an ArrayList,
  100.  
  101. |Theyre moved to the end.
  102.  
  103. boolena contains(E element) search uses
  104.  
  105. |Sequential search to locate the element.
  106.  
  107. The int indexOf method
  108.  
  109. |Searches a list for the occurrence of an object and returns its index.
  110.  
  111. One advantage of generics is
  112.  
  113. |More type problems can be uncovered at compile time.
  114.  
  115. The automatic conversion of a primitive type to a wrapper type is called
  116.  
  117. |Autoboxing.
  118.  
  119. An advantage of using generic types is
  120.  
  121. |Increased Type-safety.
  122.  
  123. Constraining a type parameter in a generic class
  124.  
  125. |Restricts the types that can be used
  126.  
  127. The Java notation MyClass<Student> means that
  128.  
  129. |MyClass is a generic class
  130.  
  131. Automatic conversion of a wrapper type to a primitive type
  132.  
  133. |Unboxing
  134.  
  135. When a generic class is made without specifying a type argument, its a
  136.  
  137. |Raw Type
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement