Concept explainers
(Asterisked problems are associated with optional sections.)
3. Rework Problem 2 assuming column major order rather than row major order 2 Suppose an array with six rows and eight columns is stored in row major order starting at address 20 (base ten). If each entry in the array requires only one memory cell, what is the address of the entry in the third row and fourth column? What it each entry requires two memory cells?
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Computer Science: An Overview (12th Edition)
Additional Engineering Textbook Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with C++: Early Objects (9th Edition)
Problem Solving with C++ (10th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out with Python (4th Edition)
- Explain the meaning of a pointer variable. For what reason is it being done? If you could explain what a dynamic array is and how it operates, would you? So, how do pointers relate to a dynamic array?arrow_forwardSub: Data structure Suppose a multidimensional array is declared as A [1...8, - 5...5, -10...5]. If base address of A is 400 and there are 4 words per memory location, then the address of A[3, 3, 3] by using ww column major order isarrow_forwardAn array Arr[50][100] is stored in the memory along the row with each element occupying 2 bytes of memory. Find out the base address of the location Arr[20][50], if the location of Arr[10][25] is stored at the address 10000.arrow_forward
- The array sum function below is called on an array of length four starting at address B. List, in order, the data addresses referenced by this function during execution. add1: add $v0, $0, $0beq1: beq $a1, $0, jr1addi1: addiu $a1, $a1, -1lw1: lw $t0, 0($a0)add2: add $v0, $v0, $t0addi2: addiu $a0, $a0, 4beq2: beq $0, $0, beq1jr1: jr $raarrow_forwardComputer Science A two-dimensional array of type int is defined in C using the same structure as a two-dimensional array in Java. If the dimensions are defined as 20 rows by 10 columns, what is the largest contiguous block of memory required by this array? Assume that the machine in question has an address size of 64-bits.arrow_forwardAn array T[-1.35][-2.15] is stored in the memory along the row with each element occupying 4 bytes. Find out the base address and address of element T[2O][5], if an element T[2][2] is stored at the memory location 300O. Find the total number of elements stored in T and number of bytes allocated to T.arrow_forward
- There is a close association between pointers and arrays. Recall that an array variable is actually a pointer variable that points to the first indexed variable of the array. Array elements can be accessed using pointer notation as well as array notion. One problem with static arrays is that we must specify the size of the array when we write the program. This may cause two different problems: (1) we may create an array much larger than needed; or (2) we may create one that is smaller than what is needed. In general, this problem is created because we do not know the size of the array until the program is run. This is where dynamic arrays can be used. The new expression can be used to allocate an array on the freestore. Since array variables are pointer variables, you can use the new operator to create dynamic variables that are arrays and treat these dynamic array variables as if they were ordinary arrays. Array elements can also be accessed using pointer notation as well as array…arrow_forwardThere is a close association between pointers and arrays. Recall that an array variable is actually a pointer variable that points to the first indexed variable of the array. Array elements can be accessed using pointer notation as well as array notion. One problem with static arrays is that we must specify the size of the array when we write the program. This may cause two different problems: (1) we may create an array much larger than needed; or (2) we may create one that is smaller than what is needed. In general, this problem is created because we do not know the size of the array until the program is run. This is where dynamic arrays can be used. The new expression can be used to allocate an array on the freestore. Since array variables are pointer variables, you can use the new operator to create dynamic variables that are arrays and treat these dynamic array variables as if they were ordinary arrays. Array elements can also be accessed using pointer notation as well as array…arrow_forwardSort the arrays based on the location of their data storage. Any advantages or downsides of allocating memory during compilation and runtime are discussed.arrow_forward
- data structure in javaarrow_forwardA JPJ department wants to maintain a database of up to 1800 license-plate numbers of people who receive frequent tickets so that it can be determined very quickly whether or not a given license plate is in the database. Speed of response is very important; efficient use of memory is also important, but not as important as speed of response. Which of the following data structures would be most appropriate for this task? A) a sorted linked list B) sorted array with 1800 entries hash table using open addressing with 1800 entries O D) a hash table using open addressing with 3600 entriesarrow_forwardin c++ In a 2D integer array TD, assume that the row indices range from -3 to 7 and column indices range from 6 to 14. An element TD [-3, 6] stored at address 3220. Find out the dimension of TD and address of an element TD [2, 10], if TD stores the elements in column major order.arrow_forward
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning