Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 11.1, Problem 4E
Program Plan Intro
To implement a direct-address dictionary on a huge array.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
in 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.
in c++
6. Consider a 2D array A[m][m], each element takes 4 bytes of storage. If the base address
at A[1][1] is 1500 and the address of A[4][5] is 1608, determine the order of the matrix
when it is stored in Column Major Wise.
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 $ra
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 02. 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 column major order isarrow_forwardx86 assembly language Write a general-purpose program with loop and indexed addressing that adds 12h to 0th, 3rd , 7th , 11th ,15th ,19th , … elements of a DWORD array. For example, in array: Array1 DWORD 12h, 13h, 14h,15h, 16h, 17h, 18h, 19h, 1ah, 1bh, 1ch, 1dh, 1eh, 1fh becomes: Array1 : 24h, 13h, 14h, 27h,16h,17h,18h, 2bh, 1ah, 1bh, 1ch, 2f, 1eh, 1fh I did the following code buts it wrong. I need to do it without using no Lea, no HLT, and no RPT. How would I do that? .CODE LEA SI,ARRAY1MOV CX,4MOV AX,0ADD [SI],12HADD SI,0CHADD [SI],12H;repetition with indexed addressing modeRPT:ADD SI,10HADD [SI],12HLOOP RPTHLTarrow_forwardAn array Array[20][15] is stored in the memory along the column with each element occupying 8 bytes of memory. Find out the Base address and address of the element Array [2][3], if the element Array [10][25] is stored at the address 1000.arrow_forward
- An 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_forwardin c++ 3. Consider a 2D array A of 30 (5x6) elements is stored in the memory of 120 bytes from 2100 to 2216. Find out the address of A[2][4] elenent in row-major and colunın-major order.arrow_forwardVectors store a linear arrangement of values, accessed by a single index. Two-dimensional arrays store a tabular arrangement of values, accessed by two indexes, for example matrix[i][j], where i is the row index, and j is the column index. A common two-dimensional array that you should have seen early on in your education is a multiplication table. For example, here is the multiplication table up to 5 x 5: 1 2 3 4 5 1 1 2 3 4 5 2 2 4 6 8 10 3 3 6 9 12 15 4 4 8 12 16 20 5 5 10 15 20 25 Write a program that asks the user for the number of rows and columns for a multiplication table and prints out the corresponding results.arrow_forward
- A one dimensional array A has indices 1....75.Each element is a string and takes up three memory words. The array is stored starting at location 1120 decimal. The starting address of A[49] is A. 1167 B. 1164 C. 1264 D. 1169arrow_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_forwardComputer Science Write a C program that calls malloc() 1001 times allocating blocks of size 4 each. Use type char * to store the pointers returned by malloc(). When done, print the difference in the addresses of the first and last block allocated. This difference is the amount of memory malloc actually used to create 1000 blocks of size 4. It is a lot more than you would expect. Repeat this for other block sizes and make a table of your results. Do you see any pattern? Any guesses why?arrow_forward
- A two dimensional array ARR[50] [20] is stored in the memory along the row with each of its elements occupying 4 bytes. Find the address of the element ARR[30][10], if the element ARR[10] [5] is stored at the memory location 15000. Please give handwritten answer!!!arrow_forward1. Write an ALGORITHM to calculate the address of any element A [I, J] of a two-dimensional array A [1: M, 1: N]. Assume the array is stored in column-major order, B is the base address of the array and w is the size of each element in the array. 2. A two-dimensional array A with n rows time and m columns can be represented in either row-major or column-major form. Establish the address translation functions to locate any element from the one-dimensional array. The element is specified by two-dimensional parameters along with the data type. 3. Write an ALGORITHM to find the transpose of a sparse matrix.arrow_forwardDevelop a merging implementation based on the following idea to reduce the required extra space to max(M, N/M): For the purpose of simplicity, split the array into N/M blocks of size M and assume that N is a multiple of M. Following that, (i) use selection sort to order the blocks, treating them as items and using their first key as the sort key; and (ii) iterate over the array, merging the first block with the second, the second block with the third, and so on. Develop a merging implementation based on the following idea to reduce the required extra space to max(M, N/M): For the purpose of simplicity, split the array into N/M blocks of size M and assume that N is a multiple of M. Following that, (i) use selection sort to order the blocks, treating them as items and using their first key as the sort key; and (ii) iterate over the array, merging the first block with the second, the second block with the third, and so on. Develop a merging implementation based on the following idea to…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning