Question 1a i what is a pointer illustrate with an

Assignment Help Data Structure & Algorithms
Reference no: EM13349703

QUESTION 1

(a) (i) What is a pointer? Illustrate with an example

(ii) Give two advantages of the use of pointers over arrays

(b) (i) Declare an array called vowel which contains the elements ‘a', ‘e', ‘i', ‘o', and ‘u'. (ii) Declare a pointer ptr of type char which points to the array vowel

(iii) Write down a loop to display the actual address and content of pointer ptr when it points to the different elements of array vowel

(c) (i) Declare an integer array of size ten

(ii) Write down appropriate statements to request the user to enter ten integer numbers into the array created in c (i) above

(iii) Write down appropriate statements which will search the number zero inside the array using linear search algorithm. Include an output statement to print out the number of elements in the array before the zero if it is found

QUESTION 2

(a) (i) How does a structure differ from a union?

(ii) How can the size of a structure be determined? In what units is the size reported?

(iii) How is a structure-type pointer variable declared? To what does this type of variable point?

(b) What is a self-referential structure? Illustrate with a suitable example

(c) (i) Define a structure that contains the following members: 1) dvd_name, 2) quantity and 3) cost Include a user-defined data-type movie within the definition

(ii) Now define another structure that contains the following members: 1) batch_id and 2) film of type movie defined above Include the user-defined data type dvd within the definition

(iii) Declare a variable v1 to be a structure variable of type dvd. Write an expression for each member and submember of v1

(iv) Declare a variable v2 to be a structure variable of type dvd and initialize v2 with the following values: dvd_name: Red Dragon quantity: 4 cost: 100 batch_id: 2101

(d) (i) What is the primary advantage to using a data file?

(ii) Describe the different ways in which a data file can be categorized

(iii) What is the purpose of a buffer area when working with data-files?

(iv) How is the buffer area defined?

(v) What is meant by opening a data file?

QUESTION 3

(a) Using an appropriate example, explain what is a recursive function?

(b) Write a small program using a function called cumulative that accepts as parameter n and returns the sum of integers between 1 and n inclusive

(c) A student was asked to write a program in C to swap two numbers using a function and pointers. However the student failed to solve the work and the program was left incomplete as shown below. Use the code extract below to complete the program using function and pointers

#include<stdio.h>

void swap(int *, int *);

void main { int a = 23, b = 32; ... ... }

void swap(int *x, int *y) { int temp; .... ..... }

QUESTION 4

(a) Write down the sample code to create a 'Linked List' and allocate storage space for a node

(b) Write down the algorithm to insert an item

(i) At the beginning of a linked list

(ii) In the middle of a linked list

(iii) At the end of a linked list

(c) Write down the sample code to declare a stack

(d) Explain how the binary tree below can be traversed in each of the following ways-

(i) preorder

(ii) inorder

(iii) postorder

361_binary tree.png

Reference no: EM13349703

Questions Cloud

Question1a offer an instance of one alternative renewable : question1a offer an instance of one alternative renewable energy source.b write down an energy transformation equation
Question 1tourism projected onto its anticipated growth : question 1tourism projected onto its anticipated growth requires an urgent integration of preventive approaches in all
Questionthink the sun to be at the origin of a : questionthink the sun to be at the origin of a xy-coordinate system. a telescope spots an asteroid in the xy-plane at a
Questionnbsp 1 soundview centre uses a periodic inventory : questionnbsp 1 soundview centre uses a periodic inventory system. at the end of 2010 the accounting records include the
Question 1a i what is a pointer illustrate with an : question 1a i what is a pointer? illustrate with an exampleii give two advantages of the use of pointers over arraysb i
Question one of sun appliances merchandises is a dishwasher : question one of sun appliances merchandises is a dishwasher. two processing departments are added in the dishwashers
Question1a puck of mass m1 760 g and radius r1 440 cm : question1a puck of mass m1 76.0 g and radius r1 4.40 cm glides across an air table at a speed of 1.50 ms. it makes a
Question the diamond freight company has been provided a : question the diamond freight company has been provided a seven-year contract to haul munitions for the government.
Questionsome of properties of a diatomic molecule no can be : questionsome of properties of a diatomic molecule no can be described in terms of a effortless model in which two atoms

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Write an algorithm called find-g

Write an algorithm called "Find-G" to nd a maximally-general consistent hypothesis. You can assume the data will be noise-free and that the target concept is in the hypothesis space.

  Write the implementation of a data structure

Write an implementation of a data structure S that supports the following operations: Insert(S, x): insert the key x into S only if it is not already there.

  What data structure is most suitable

What data structure is most suitable to determine if a string s is a palindrome, that is, it is equal to its reverse. For example, "racecar" and "gohangasalamiimalasagnahog" are palindromes. Justify your answer. Use Big-O notation to represent the..

  Explain feasibility analysis for jobs of lrt algorithm

Study feasibility analysis for jobs of LRT algorithm when preemption is allowed. Which scheduling algorithm is best suited for high speed networks and why? Distinguish between static and dynamic systems.

  Creating algorithm broken into sequence of words

Katt wishes you to create an algorithm that, given a string X, determines efficiently how many ways X can be broken up into sequence of words.

  Describe sorting algorithms and how they work

Describe sorting algorithms and how they work

  Draw flowchart to print average for each student

Draw a flowchart to print the average for each student in a class. Input. Input consists of student records each containing a student's name(STUDENT-NAME), score for first test(TEST), score for second test(TEST2), and score for third test(TEST3)..

  Use of primitives helps remove ambiguities in algorithm

Explain the distinction between an ambiguity in a proposed algorithm and an ambiguity in the representation of an algorithm. Describe how the use of primitives helps remove ambiguities in an algorithm's representation.

  Write a program to find average marks

Write a program to find average marks obtained by 10 students in a test along with algorithm and write a menu driven program using function to perform following operations on 1 d array?

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Java program to find largest and smallest numbers

Create a Java program that will search a text document of strings representing numbers of type int and will write the largest and the smallest numbers to screen.

  Linked list class to hold a series of integers

1) Design your own linked list class to hold a series of integers. The class should have member functions for appending, inserting, and deleting nodes. Dont forget to add a destructor that destroys the list. Demonstrate the class with a driver progra..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd