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

  Describe how algorithm works for adjacency matrix

All vertices according to their type (head, neck, shoulder, hip, front foot or rear foot). Note that as adjacency matrix has n2 entries, you can't scan entire matrix in O(n) time. Describe how algorithm works.

  How to work on datasturetur assignment kdfk dskf

kdfk dskf jkfjksdjkf jksdjfkjskfjksdjkf jksdjkf jsdkjfk dsk fkdsjkfj kdsjkf jdsk jksdjkf kdfk dskf jkfjksdjkf

  Write algorithm to create job applicant report

Write the algorithm to create job applicant report. Input consists of a series of records that contain the Social Security number or equivalent, last name, first name, middle initial.

  Design the logic that merges the two files

Design the logic that merges the two files to produce one combined name-and-address file, which the office staff can use for addressing mailings of the practice's monthly Healthy Lifestyles newsletter

  Data structures class

data structures class this project will give you an introduction. There are two important data structures that you will learn and use. The first is a stack, it is a LIFO (Last In First Out) structure. You can think of it like a a stack of plates in y..

  Generalize 2-3 algorithms for insert and delete

Generalize the 2-3 algorithms for INSERT and DELETE to K-J trees, where non-leaf vertices have between K and J children for fixed integers K >=2, and J>= 2K-1.

  Design an algorithm to determine best route for passenger

Consider the following problem: Design an algorithm to determine the best route for a subway passenger to take from one designated station to another in a typical urban subway system similar to those in San Francisco and New York

  Pseudocode program

Write a program that inputs the first name, middle initial (without the period), last name, age, salary and sex of new employee. Then displays that person's name with the first name first, middle initial followed by a period, and last name then ag..

  Sketch dynamic programming tables for knapsack problem

Sketch Dynamic Programming Tables (one for calculating optimal value and one for keeping track of items used in getting optimal value) for 0/1 Knapsack Problem given below and illustrate your final result.

  What items do we require for a small business wlan what

imagine that you work at a small company with 75 employees in a modern office building. some of the employees are eager

  What is the efficiency of searching for a particular word

Do the same for dictionary whose words are sorted alphabetically. Compare results.

  Function to swap all the left-right subtrees of binary tree

Write a function, swapSubTrees, that swaps all of the left and right subtrees of a binary tree. write a method singleParent, that returns the number of nodes in a binary tree that have only one child.

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