Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

make program that makes 4 directional linked lists to appear like the diagram i made below. The Program needs to ask the user for a

make program that makes 4 directional linked lists to appear like the diagram i made below. The Program needs to ask the user for a starting node and a ending node.They are able to choose any starting and ending locations and your program should be able to begin from that starting node (by placing a pointer to that node) and going through each of the 4 directions until it finds the ending node.At this point, it should output the path it too. Use only one recursive function.This function's base case is if the current node it is located in is equal to the node the user typed in as the ending node.If it is, you are to output the name of that node and terminate the current node (this base case gives the path in reverse, which is what I need).

A <------------->B C

^ ^ ^

| | |

| | |

v v v

D E <----------------->F

^ ^

| I

| I

v v

G <------------>H I

Assuming it goes up, left, down, right

OUTPUT:

Please enter the starting node:B

Please enter the destination node: I

Going left to A

Going down to D

D ends

A ends

Going down to E

Going down to H

Going left to G

G ends

H ends

Going right to F

Going up to C

C ends

Going down to I

Destination Reached, path was:I F E B

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions