Find the value of each given expression

Assignment Help Data Structure & Algorithms
Reference no: EM131028362

1. Answer the following questions for the linked list and node refereces P1, P2, P3 and P4 (Here Cat, Dog, Ewe, and Rat are the data content of nodes, and P1, P2, P3, P4 are four references, the same as first reference).

Draw a similar diagram as below to show how this configuration changes when the given program segment is executed, or explain why an error occurs (data is a string in every node).

Every subquestion is independent and based on the initial figure

shown below.

a. P1 = P2.next;

b. P4 = P1;

c. P4.data = P1.data;

d. P4.next.data = P1.data;

e. P2.next = P3.next;

f. P4.next = P1;

g. P1.next = P3.next; P1 = P3;

h. P1 = P3; P1.next = P3.next;

i. P4.next = P3.next; P3.next = P2.next; P2.next = P1.next; Cat Dog Ewe Rat P1 P2 P3 P4 null COSC 3331 DS & Algorithms hw3

j. P4.next = P3; P4.next.next = P2; P4.next.next.next = P1; P1.next=null;

2. Answer the following questions for following doubly-linked list with the two references

P1 and P2: (Find the value of each expression.)

Every subquestion is independent and based on the initial figure

shown above.

a. P1.data;

b. P1.next.data;

c. P1.prev.prev;

d. P1.next.next;

e. P1.prev.next;

f. P2.prev.prev.data;

g. P2.prev.prev.prev.prev;

h. P2.prev.prev.next.data;

3. Answer all the sub-questions for Problem 2 but for the following circular doubly-linked list with the two references P1 and P2: (Find the value of each expression.)

Every subquestion is based on the initial figure shown above.

a. P1.data;

b. P1.next.data;

c. P1.prev.prev; D I R T Y null null null P1 P2 B E S T P1 P2 COSC 3331 DS & Algorithms hw3

d. P1.next.next;

e. P1.prev.next;

f. P2.prev.prev.data;

g. P2.prev.prev.prev.prev;

h. P2.prev.prev.next.data;

Reference no: EM131028362

Questions Cloud

What could the second hospital do to increase their level : What is the first hospital doing that is yielding a high level of quality? What could the second hospital do to increase their level of quality? Finally, how would you increase value to the services provided by both hospitals
Circuit with d flip-flops and and gates : Design the circuit with inputs Xa , X b , X c  , and Xd , reset L, clock C, and output U. Use a 1-hot code for the state assignment. Implement the circuit with D flip-flops and AND gates, OR gates, and inverters.
Design a sequential circuit : Design a sequential circuit with two D ?ip-?ops A and B and one input X. When X = 0, the state of the circuit remains the same. When X = 1, the circuit goes through the state transitions from 00 to 10 to 11 to 01, back to 00, and then repeats.
Draw a venn diagram illistrating the relationship among sets : use the sets provided to draw a venn diagram illistrating the relationship amoung the sets
Find the value of each given expression : Answer all the sub-questions for Problem 2 but for the following circular doubly-linked list with the two references P1 and P2: Find the value of each expression.
Prepare a one page mind-map to consolidate topics : Critically apply technical accounting knowledge and skills to solve advanced accounting problems - Justify and analyse relevant issues and theories underlying the development of specific accounting standards.
Find the m-step ahead forecast : i. Is this process invertible? Why? if it is, find the coefficients in the expansion Vt = ? cj Yt - j , j from 0 to 8. ii. Find the m-step ahead forecast of Yn+m ( and its variance) based on the infinite past.
In how many ways can a man divide 7 gifts among 3 children : By focusing first on the choice of the committee and then on the choice of the chair, argue that there are (n choose k)?k possible choices.
Explain the influence and importance of stakeholders : Write a 750 words proposal that discusses the research-based benefits of using EMR technology. Explain the purpose of utilizing research in health administration. Explain the influence and importance of stakeholders in research utilization

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Stack to check for balanced braces

In a program that uses a stack to check for balanced braces in an string, what condition indicates that the braces are balanced when the end of the string is reached

  Write the algorithm and find out the time complexity

Write the algorithm and find out the time complexity for the algorithm (in terms of n and m). Note that given two locations (x1, y1) and (x2, y2), distance between them can be calculated by the subsequent formula: ? (x2 - x1)2 + (y2 - y1)2.

  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.

  Portfolio website containing thumbnail imagery

Explain in general terms what you think the role of good design is. Next, recognize 3-characteristics of an effective gallery website. Then find an example of a portfolio website containing thumbnail imagery.

  Linear-time algorithm for computing the strong component

Describe a linear-time algorithm for computing the strong component containing a given vertex v - On the basis of that algorithm, explain a simple quadratic-time algorithm for computing the strong components of a digraph.

  Algorithm of prim

NFR4: Prim's algorithm should be used to find a minimum spanning tree (see FR6). NFR5: Dijkstra's  algorithm should be used to find a shortest path between two stations (FR7).

  Algorithm for finding smallest element in unsorted array

Consider the following algorithm for finding the smallest element in an unsorted array: RANDOMMIN(A[1 .. n]). What is the exact expected number of executions of line ( )?

  Draw a red-black tree

Draw a red-black tree for the following values inserted in this order. Illustrate each operation that occurs: w k o s y t p r

  Possible external-memory map implementation

Another possible external-memory map implementation is to use a skip list, but to collect consecutive groups of  O ( B ) nodes, in individual blocks, on any level in the skip list

  Design a nonrecursive algorithm

Design a nonrecursive algorithm that visits all the nodes of a general multiway tree in level order: that is, level-by-level, going left-to-right across a level.

  Problem 1given n courses along with their course strength

problem 1given n courses along with their course strength and m examination halls along with their capacity assign the

  Draw one child diagram using the level 0 diagram

As a systems analyst or knowledgeable end-user, you must learn how to draw data flow diagrams to model business process requirements.

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