
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
These are the Lecture Slides of Algorithms and Applications in Java which includes Greedy Method, Divide and Conquer, Dynamic Programming, Backtracking, Branch and Bound, Integer Programming, Neural Networks, Genetic Algorithms, Tabu Search etc.Key important points are: Arrays, Array Representation, Dimensional Array, Contiguous Memory Locations, Space Overhead, 2d Arrays, Array of Rows, Number of Rows, Array-Of-Arrays Representation, Memory Block
Typology: Slides
1 / 24
This page cannot be seen from the preview
Don't miss anything!
Memory
a b c d
start
The elements of a 2-dimensional array a declared as:
int [][]a = new int[3][4];
may be shown as a table
a[0][0] a[0][1] a[0][2] a[0][3] a[1][0] a[1][1] a[1][2] a[1][3] a[2][0] a[2][1] a[2][2] a[2][3]
a[0][0] a[0][1] a[0][2] a[0][3] row 0
a[1][0] a[1][1] a[1][2] a[1][3] row 1
a[2][0] a[2][1] a[2][2] a[2][3] row 2
view 2D array as a 1D array of rows x = [row0, row1, row 2] row 0 = [a,b, c, d] row 1 = [e, f, g, h] row 2 = [i, j, k, l] and store as 4 1D arrays
2-dimensional array x a, b, c, d e, f, g, h i, j, k, l
x.length = 3 x[0].length = x[1].length = x[2].length = 4
a b c d e f g h
i j k l
x[]
a b c d e f g h
i j k l
x[]
a b c d e f g h i j k l
row 0 row 1 row 2 … row i
Space Overhead
4 bytes for start of 1D array + 4 bytes for length of 1D array + 4 bytes for c (number of columns) = 12 bytes
(number of rows = length /c)
row 0 row 1 row 2 … row i
Need contiguous memory of size rc.
Table of values. Has rows and columns, but numbering begins at 1 rather than 0. a b c d row 1 e f g h row 2 i j k l row 3
An n x n matrix in which all nonzero terms are either on or below the diagonal.