problem question please need urgent answers
Problem Statement
Given a cyclic list with elements as numbers in sorted order, write a function to insert a new element (5) into the cyclic list that maintains the sorted order of the cyclic list. Do not assume that the cyclic list is referenced by its minimal element. A perfectly cyclic list is one where the nth node's 'next' pointer points to the same place as 'head' --
User would get a custom data type as Node. It is defined as
public class Node
{
public int data;
public Node next;
}
You are given a function addElement which takes in the head pointer of the cyclic linked list. Complete the function to insert the number 5 such that the sorted order is maintained and return the head node of the modified linked list. You only need to complete this function. The Main and Node classes for storing linked list are already defined, so you will not need to add them. Every time you submit your code it will be compiled and a small suite of tests will be run against your code and you will be shown the results.
When you complete the problem a larger suite of tests will be run to test your implementation. If you successfully pass the displayed tests, use your extra time to make sure your code handles other edge cases appropriately.
Input/Output Specs
Inputs Specs:
The data in test case starts and ends with brackets ( ). Within the brackets lies the following information
(Node input1) where
input1 is the head pointer of the cyclic linked list. A cyclic linked list i.e. the next of the Last node is the first node , so for {1,2} the Node having 1 would have the next element as 2 and the node with data as 2 the next value would point to 1
Output Specs:
You need to return the head node of the modified linked list.
Examples
Input values:
2->6
Expected Output value :
2->5->6
View Answers
Ads
Related Tutorials/Questions & Answers:
problem question please need urgent answers
problem question please need urgent answers
Problem Statement
Given.... You only
need to complete this function. The Main and Node classes for storing linked list are already defined, so you will not
need to add them. Every time you
problem question please need urgent answers
problem question please need urgent answers
Problem Statement
Given.... You only
need to complete this function. The Main and Node classes for storing linked list are already defined, so you will not
need to add them. Every time you
Advertisements
urgent need
urgent need Input a line. Count the number of words that start with a capital letter
urgent...pleAse help me.....please!
urgent...
pleAse help me.....
please!
please help me
urgent! how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
PLease reply its urgent
PLease reply its
urgent Write a java function that has the signature
ââ?¬Å?Public static int clock Inter sections(int hours, int minutes)ââ?¬Â...:minute:second format.
How's that
urgent
urgent please, help!
urgent please, help! how to make jTable unclickable and have unmovable columns, thanks in advance
import javax.swing.*;
import java.awt.*;
public class SimpleJTableExample{
public static void main(String[] args
Need urgent help with C++ errors!
Need urgent help with C++ errors! hi,
i'm new to C++ programming... don't know what to do.
Please help!!
#include<iostream.h>
void main...'
Fatal XYZ.CPP 2: Unable to create output file 'C:\XYZ.obj'
somebody
please
need help please
need help please Dear sir, my name is logeswaran. I have a big
problem that I can't find the solution for a program. How can I block a user from enter a page second time.
Please help me.
By the way I'm using Access database
need help...................please
need help...................please I have a
problem in my JSP Coding... on this area.
Please help me.
By the way, I'm using access Database and JSP coding...("GET",url,true)
xmlHttp.send(null)
}
else{
alert("
Please Select Employee Id
Please provide the coding for this problem
Please provide the coding for this problem
Please provide the coding for the following
problem. Write a "hangman" game that randomly generates a word and prompts the user to guess one letter at a time. Each letter in the word
please help me to this problem..
please help me to this
problem.. i wrote a program like keyboard and i used [JTextFiled] means that just you can write inside the program (i.e inside the JTextField) but i want to make this program to let me write where i
Please help me... its very urgent
Please help me... its very urgent
Please send me a java code to check whether INNODB is installed in mysql...
If it is there, then we
need to calculate the number of disks used by mysql
i need a help in this please
i
need a help in this please The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??)
and is defined as follows:
n!=n . (n-1) . (n-2) . .... . 1 (for values of n greater than or equal to 1) and
n!=1
PLEASE HELP CAPTCHA PROBLEM
PLEASE HELP CAPTCHA PROBLEM how can i make the captcha refresh autometically ????
please help
this is
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing"%>
<%@ Import Namespace
Please Help To Solve My Problem
Please Help To Solve My Problem PHP
I Have 6 Textbox and 1 ok... This
Problem With If...Else If...Else Statement But When the More Team Are There Then It's Large Codding
So I
Need To Help To Another Way To Do
need to fix errors please help
need to fix errors
please help it does have 2 errors what should i...;
String name2;
System.out.println("
please enter your name:");
name1= input.readline();
System.out.println("
please enter your friend's name:");
name2
Please provide coding for following problem
Please provide coding for following problem
Please provide the coding for the following
problem:
You will write a java program that will read data from a file. The data in the file will be:
John Doe 75
Joe Blow 65
Mary Smith 80
problem in writing coding. Please help me.
problem in writing coding.
Please help me. Hi sir, my name is Logeswaran. I have
problem in writing JSP coding for my university assigments. Actually I'm doing a Voting System. I
need to know how to write JSP coding
Please help need quick!!! Thanks
Please help
need quick!!! Thanks hey i keep getting stupid compile errors and don't understand why. i'm supposed to use abstract to test a boat race simulation program of sorts here is my code:
RentforthBoatRace.java
public
i need help to solve this problem
i
need help to solve this problem Write a stack class ArrayStack.java implements PureStack interface that reads in strings from standard input and prints them in reverse order. and
Show step by step what queue will look like