EBK DATA STRUCTURES AND ALGORITHMS IN C
EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
bartleby

Concept explainers

Question
Book Icon
Chapter 1, Problem 3E

a)

Program Plan Intro

The content of array is been initialized with given values and “*p” is assigned to the beginning of the array, now after executing each instructions individually results are obtained given below.

Explanation of Solution

Explanantion:

In the above program , an integer array is been declared first. A pointer “p” points to array. The pointer “p” is been incremented to obtain second element of integer array. Finally,program displays contents of array and value of “p”

Therefore, the content of “intArray” will be

Explanation of Solution

b)

(*p)++;

The integer pointer “p” points to first elemenst of the array. So, “*(p)++” denotes that first element of array is been incremented first and then it is assigned to “*p”. Hence, first element of array increments as a result of this instruction.

This program shows execution of the construct and displays the result of the array and value of “p”.

Program:

//Select header files

#include <stdio.h>

#include<iostream>

using namespace std;

// Main function

int main(void)

{

  // Integer array with declaration

  int arr[] = {1,2,3};

Here, “p” denotes pointer to integer array...

Explanation of Solution

Explanantion:

In the above program an integer array is declared first. A pointer “p” points to array. The content pointed to by “p” is been incremented . Finally program displays contents of array and value of “p”.

Therefore, the content of “intArray” will be {

Explanation of Solution

c)

*p++; (*p)++;

The integer pointer “p” points to first element of array. So, *p++ denotes second element of array. Hence, second element of array increments and the incremented value is stored in “p”.

This program shows the execution of the construct and displays result of array and value of “p”.

Program:

//Select header files

#include <stdio.h>

#include<iostream>

using namespace std;

// Main function

int main(void)

{

  // Integer array with declaration

  int arr[] = {1,2,3};

...

Explanation of Solution

Explanantion:

In the above program an integer array is declared first. A pointer “p” points to array. The pointer is incremented, so that it now points to second element of array . Now, the contents pointed to by “p” is been incremented. Finally the program displays contents of array and value of “p”

Therefore, the content of “intArray” will be

Blurred answer
Students have asked these similar questions
Write a code in C language that will create graphs and write them to a file in a particular format. The program should be able to accept a number of vertices, create an cycleusing adjacency list data structure and finally output the graph. Where N is the number of vertices in the graph with V vertices and E edges. P[] = Pointer for each vertex V, 1 <= V <= N denoting the starting point in E[] of the list ofvertices adjacent to vertex V. That is, the vertices adjacent to vertex V are indicated inlocations E[P[V]], E[P[V]+1], ..., E[P[V+1]-1].E[] = list of distinct graph edges (length = 2E)Give the asymptotic running timeRun your code for various values of n and time itCreate a table showing the running times for various values.Create a graph of the running times vs various values. Use a linear scale on theaxis.
The goal of this second exercise is to develop a better understanding of the Linuxinterprocess communication mechanisms. This would require you to write twoprograms P1 and P2. The first program P1 needs to generate an array of 50random strings (of characters) of fixed length each. P1 then sends a group offive consecutive elements of the array of strings to P2 along with the ID’s ofthe strings, where the ID is the index of the array corresponding to the string.The second program P2 needs to accept the received strings, and send backthe highest ID received back to P1 to acknowledge the strings received. Theprogram P2 simply prints the ID’s and the strings on the console. On receivingthe acknowledged packet, P1 sends the next five strings, with the string elementsstarting from the successor of the acknowledged ID. The above mechanism needs to be implemented FIFO and UNIX DOMAIN SOCKETS. Please note that you may NOT make assumptions about the reliability of the interprocess communication…
An “inverted file” is a critical data structure for implementing applications like the index of a book, or a web search engine.  Given a document D (which can be viewed as an unordered, numbered list of words), an inverted file is an ordered list of words L such that for each word W in L, we store the indices of the places in D where W appears.  Write a C# program (from scratch please, written by yourself (ask instructor if you are stuck), not borrowed from any other sources) that reads in a list of words separated by spaces from a text file, then uses an efficient O(N) algorithm to create the inverted file index (hint: consider the topic of this chapter, consider using a Dictionary/hashtable to help you), and writes this index out to another file or prints it to the screen.  Each line of the output file should start with the next word (the words should be listed in alphabetical order, and this sorting does not have to be part of the O(N) runtime complexity, e.g. you can use regular…
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education