SlideShare a Scribd company logo
1 of 11
Download to read offline
Hi, Please find my code.
I have correted all of your classes.
Please let me know in case if do not get concpt.
######## Node.java ###########
public class Node {
private E element;
private Node next;
public Node() {
this.element = null;
this.next = null;
}
public Node(E e) {
this.element = e;
this.next = null;
}
public E getElement() {
return this.element;
}
public void setElement(E element) {
this.element= element;
}
public Node getNext() {
return next;
}
public void setNext(Node next) {
this.next = next;
}
}
########## Stack.java #############
public class Stack {
private int N;
private Node top;
public Stack() {
N = 0;
this.top =null;
}
/*
* places element on the top of the stack
*/
public void push(E element){
Node temp = new Node(element);
temp.setNext(top);
top = temp;
N++;
}
/*
* remove the top node and return its contents
*/
public E pop(){
if(top == null)
return null;
E e = top.getElement();
top = top.getNext();
N--;
return e;
}
/*
* Look at the top element of the Stack and return it, without removing
*/
public E peek(){
if(top == null)
return null;
return top.getElement();
}
//returns the size of the stack
public int size(){
return N; //replace
}
public boolean isEmpty(){
return top==null;
}
}
############ Queue.java ############
public class Queue {
private Node front;
private Node back;
private int N;
public Queue() {
this.front = null;
this.back = null;
N = 0;
}
/*
* places element in the back of the Queue
*/
public void enqueue(E element){
Node temp = new Node(element);
if(front == null) {
front = temp;
back = temp;
}
else{
back.setNext(temp);
back = temp;
}
N++;
}
/*
* remove the front node of the queue and return it
*/
public E dequeue(){
if(front == null) {
return null;
}
E item = front.getElement();
front = front.getNext();
// if we had only one element
if(front == null){
back = null;
}
N--;
return item;
}
/*
* Look at the front of the queue and return it, without removing
*/
public E peek(){
if(back == null)
return null;
return back.getElement();
}
//returns the size of the queue
public int size(){
return N;
}
public boolean isEmpty(){
return front==null;
}
}
########### Palindrome.java ############
import java.util.Scanner;
public class Palindrome
{
public static void main(String[ ] args)
{
Scanner input = new Scanner(System.in);
String inputString;
System.out.print("Please enter your string: ");
inputString = input.next( );
if (isPalindrome( inputString )){
System.out.println("Yes it is a palindrome.");
}
else{
System.out.println("No this is not a palindrome.");
}
}
public static boolean isPalindrome(String input)
{
Queue q = new Queue ();
Stack s = new Stack ();
char letter;
int i;
for (i = 0; i < input.length( ); i++)
{
letter = input.charAt(i);
q.enqueue(letter);
s.push(letter);
}
while (!q.isEmpty( ))
{
if (q.dequeue() != s.pop( ))
return false;
}
return true;
}
}
/*
Sample Output:
Please enter your string: MadaM
Yes it is a palindrome.
*/
Solution
Hi, Please find my code.
I have correted all of your classes.
Please let me know in case if do not get concpt.
######## Node.java ###########
public class Node {
private E element;
private Node next;
public Node() {
this.element = null;
this.next = null;
}
public Node(E e) {
this.element = e;
this.next = null;
}
public E getElement() {
return this.element;
}
public void setElement(E element) {
this.element= element;
}
public Node getNext() {
return next;
}
public void setNext(Node next) {
this.next = next;
}
}
########## Stack.java #############
public class Stack {
private int N;
private Node top;
public Stack() {
N = 0;
this.top =null;
}
/*
* places element on the top of the stack
*/
public void push(E element){
Node temp = new Node(element);
temp.setNext(top);
top = temp;
N++;
}
/*
* remove the top node and return its contents
*/
public E pop(){
if(top == null)
return null;
E e = top.getElement();
top = top.getNext();
N--;
return e;
}
/*
* Look at the top element of the Stack and return it, without removing
*/
public E peek(){
if(top == null)
return null;
return top.getElement();
}
//returns the size of the stack
public int size(){
return N; //replace
}
public boolean isEmpty(){
return top==null;
}
}
############ Queue.java ############
public class Queue {
private Node front;
private Node back;
private int N;
public Queue() {
this.front = null;
this.back = null;
N = 0;
}
/*
* places element in the back of the Queue
*/
public void enqueue(E element){
Node temp = new Node(element);
if(front == null) {
front = temp;
back = temp;
}
else{
back.setNext(temp);
back = temp;
}
N++;
}
/*
* remove the front node of the queue and return it
*/
public E dequeue(){
if(front == null) {
return null;
}
E item = front.getElement();
front = front.getNext();
// if we had only one element
if(front == null){
back = null;
}
N--;
return item;
}
/*
* Look at the front of the queue and return it, without removing
*/
public E peek(){
if(back == null)
return null;
return back.getElement();
}
//returns the size of the queue
public int size(){
return N;
}
public boolean isEmpty(){
return front==null;
}
}
########### Palindrome.java ############
import java.util.Scanner;
public class Palindrome
{
public static void main(String[ ] args)
{
Scanner input = new Scanner(System.in);
String inputString;
System.out.print("Please enter your string: ");
inputString = input.next( );
if (isPalindrome( inputString )){
System.out.println("Yes it is a palindrome.");
}
else{
System.out.println("No this is not a palindrome.");
}
}
public static boolean isPalindrome(String input)
{
Queue q = new Queue ();
Stack s = new Stack ();
char letter;
int i;
for (i = 0; i < input.length( ); i++)
{
letter = input.charAt(i);
q.enqueue(letter);
s.push(letter);
}
while (!q.isEmpty( ))
{
if (q.dequeue() != s.pop( ))
return false;
}
return true;
}
}
/*
Sample Output:
Please enter your string: MadaM
Yes it is a palindrome.
*/

More Related Content

Similar to Hi, Please find my code.I have correted all of your classes.Plea.pdf

can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfsales88
 
A linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfA linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfkisgstin23
 
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdfHow do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdfpnaran46
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfaashienterprisesuk
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdfaarokyaaqua
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfravikapoorindia
 
import java-util--- public class MyLinkedList{ public static void.pdf
import java-util---  public class MyLinkedList{    public static void.pdfimport java-util---  public class MyLinkedList{    public static void.pdf
import java-util--- public class MyLinkedList{ public static void.pdfasarudheen07
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfinfo430661
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfxlynettalampleyxc
 
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfimport java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfStewart29UReesa
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfarjuntelecom26
 
public class CircularDoublyLinkedList-E- implements List-E- { privat.pdf
public class CircularDoublyLinkedList-E- implements List-E- {   privat.pdfpublic class CircularDoublyLinkedList-E- implements List-E- {   privat.pdf
public class CircularDoublyLinkedList-E- implements List-E- { privat.pdfChristopherkUzHunter
 
1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdfafgt2012
 
How do you update an address according to this code- Currently- I fig.pdf
How do you update an address according to this code-  Currently- I fig.pdfHow do you update an address according to this code-  Currently- I fig.pdf
How do you update an address according to this code- Currently- I fig.pdfThomasXUMParsonsx
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfamazing2001
 
using set identitiesSolutionimport java.util.Scanner; c.pdf
using set identitiesSolutionimport java.util.Scanner;  c.pdfusing set identitiesSolutionimport java.util.Scanner;  c.pdf
using set identitiesSolutionimport java.util.Scanner; c.pdfexcellentmobilesabc
 
Need Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdfNeed Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdfarchiesgallery
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfmichardsonkhaicarr37
 
This is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.pdfThis is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.pdffcaindore
 
Modifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdfModifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdfLalkamal2
 

Similar to Hi, Please find my code.I have correted all of your classes.Plea.pdf (20)

can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdf
 
A linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfA linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdf
 
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdfHow do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdf
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
 
import java-util--- public class MyLinkedList{ public static void.pdf
import java-util---  public class MyLinkedList{    public static void.pdfimport java-util---  public class MyLinkedList{    public static void.pdf
import java-util--- public class MyLinkedList{ public static void.pdf
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdf
 
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfimport java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdf
 
public class CircularDoublyLinkedList-E- implements List-E- { privat.pdf
public class CircularDoublyLinkedList-E- implements List-E- {   privat.pdfpublic class CircularDoublyLinkedList-E- implements List-E- {   privat.pdf
public class CircularDoublyLinkedList-E- implements List-E- { privat.pdf
 
1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf
 
How do you update an address according to this code- Currently- I fig.pdf
How do you update an address according to this code-  Currently- I fig.pdfHow do you update an address according to this code-  Currently- I fig.pdf
How do you update an address according to this code- Currently- I fig.pdf
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
 
using set identitiesSolutionimport java.util.Scanner; c.pdf
using set identitiesSolutionimport java.util.Scanner;  c.pdfusing set identitiesSolutionimport java.util.Scanner;  c.pdf
using set identitiesSolutionimport java.util.Scanner; c.pdf
 
Need Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdfNeed Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdf
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdf
 
This is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.pdfThis is problem is same problem which i submitted on 22017, I just.pdf
This is problem is same problem which i submitted on 22017, I just.pdf
 
Modifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdfModifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdf
 

More from pritikulkarni20

When the butanol is protonated, it is ionic and hence more soluble .pdf
 When the butanol is protonated, it is ionic and hence more soluble .pdf When the butanol is protonated, it is ionic and hence more soluble .pdf
When the butanol is protonated, it is ionic and hence more soluble .pdfpritikulkarni20
 
Where is the reaction See what is the no. of m.pdf
                     Where is the reaction  See what is the no. of m.pdf                     Where is the reaction  See what is the no. of m.pdf
Where is the reaction See what is the no. of m.pdfpritikulkarni20
 
viscous increases due to bulkiness and interlocki.pdf
                     viscous increases due to bulkiness and interlocki.pdf                     viscous increases due to bulkiness and interlocki.pdf
viscous increases due to bulkiness and interlocki.pdfpritikulkarni20
 
The factors which affect are H bond Electronegat.pdf
                     The factors which affect are H bond Electronegat.pdf                     The factors which affect are H bond Electronegat.pdf
The factors which affect are H bond Electronegat.pdfpritikulkarni20
 
The compund with the lowest value of Ksp will pre.pdf
                     The compund with the lowest value of Ksp will pre.pdf                     The compund with the lowest value of Ksp will pre.pdf
The compund with the lowest value of Ksp will pre.pdfpritikulkarni20
 
SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdf
                     SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdf                     SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdf
SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdfpritikulkarni20
 
pKb = 4.7 pOH = 4.7 + log 0.20 0.25 =4.6 pH = 1.pdf
                     pKb = 4.7 pOH = 4.7 + log 0.20  0.25 =4.6 pH = 1.pdf                     pKb = 4.7 pOH = 4.7 + log 0.20  0.25 =4.6 pH = 1.pdf
pKb = 4.7 pOH = 4.7 + log 0.20 0.25 =4.6 pH = 1.pdfpritikulkarni20
 
Pouring the product on ice has two effects Firs.pdf
                     Pouring the product on ice has two effects  Firs.pdf                     Pouring the product on ice has two effects  Firs.pdf
Pouring the product on ice has two effects Firs.pdfpritikulkarni20
 
pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdf
                     pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdf                     pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdf
pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdfpritikulkarni20
 
NH3 is lewis base according to lewis electron pai.pdf
                     NH3 is lewis base according to lewis electron pai.pdf                     NH3 is lewis base according to lewis electron pai.pdf
NH3 is lewis base according to lewis electron pai.pdfpritikulkarni20
 
Li has high reduction potential than Cobalt ther.pdf
                     Li has high reduction potential than Cobalt  ther.pdf                     Li has high reduction potential than Cobalt  ther.pdf
Li has high reduction potential than Cobalt ther.pdfpritikulkarni20
 
Has two binding sites for oxygen .pdf
                     Has two binding sites for oxygen                 .pdf                     Has two binding sites for oxygen                 .pdf
Has two binding sites for oxygen .pdfpritikulkarni20
 
Types of physical situations or occurrencesIt is important to und.pdf
Types of physical situations or occurrencesIt is important to und.pdfTypes of physical situations or occurrencesIt is important to und.pdf
Types of physical situations or occurrencesIt is important to und.pdfpritikulkarni20
 
The term illegal acts, refers to violations of laws or governmental .pdf
The term illegal acts, refers to violations of laws or governmental .pdfThe term illegal acts, refers to violations of laws or governmental .pdf
The term illegal acts, refers to violations of laws or governmental .pdfpritikulkarni20
 
Strategic planning has long been used as a tool for transforming and.pdf
Strategic planning has long been used as a tool for transforming and.pdfStrategic planning has long been used as a tool for transforming and.pdf
Strategic planning has long been used as a tool for transforming and.pdfpritikulkarni20
 
Sorry I didnt get the question what you postSolutionSorry I .pdf
Sorry I didnt get the question what you postSolutionSorry I .pdfSorry I didnt get the question what you postSolutionSorry I .pdf
Sorry I didnt get the question what you postSolutionSorry I .pdfpritikulkarni20
 
delta H = 282.1 = 164.2 KJ .pdf
                     delta H = 282.1 = 164.2 KJ                      .pdf                     delta H = 282.1 = 164.2 KJ                      .pdf
delta H = 282.1 = 164.2 KJ .pdfpritikulkarni20
 
Sella turcica is the depression in the sphenoid bone of the skull. S.pdf
Sella turcica is the depression in the sphenoid bone of the skull. S.pdfSella turcica is the depression in the sphenoid bone of the skull. S.pdf
Sella turcica is the depression in the sphenoid bone of the skull. S.pdfpritikulkarni20
 
P(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdf
P(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdfP(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdf
P(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdfpritikulkarni20
 
Ans 1)Difference- DNA is double stranded where as RNA is single .pdf
Ans 1)Difference- DNA is double stranded where as RNA is single .pdfAns 1)Difference- DNA is double stranded where as RNA is single .pdf
Ans 1)Difference- DNA is double stranded where as RNA is single .pdfpritikulkarni20
 

More from pritikulkarni20 (20)

When the butanol is protonated, it is ionic and hence more soluble .pdf
 When the butanol is protonated, it is ionic and hence more soluble .pdf When the butanol is protonated, it is ionic and hence more soluble .pdf
When the butanol is protonated, it is ionic and hence more soluble .pdf
 
Where is the reaction See what is the no. of m.pdf
                     Where is the reaction  See what is the no. of m.pdf                     Where is the reaction  See what is the no. of m.pdf
Where is the reaction See what is the no. of m.pdf
 
viscous increases due to bulkiness and interlocki.pdf
                     viscous increases due to bulkiness and interlocki.pdf                     viscous increases due to bulkiness and interlocki.pdf
viscous increases due to bulkiness and interlocki.pdf
 
The factors which affect are H bond Electronegat.pdf
                     The factors which affect are H bond Electronegat.pdf                     The factors which affect are H bond Electronegat.pdf
The factors which affect are H bond Electronegat.pdf
 
The compund with the lowest value of Ksp will pre.pdf
                     The compund with the lowest value of Ksp will pre.pdf                     The compund with the lowest value of Ksp will pre.pdf
The compund with the lowest value of Ksp will pre.pdf
 
SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdf
                     SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdf                     SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdf
SO4 2- ---sulphate ion H2SO4---2H+ +SO4 2- conce.pdf
 
pKb = 4.7 pOH = 4.7 + log 0.20 0.25 =4.6 pH = 1.pdf
                     pKb = 4.7 pOH = 4.7 + log 0.20  0.25 =4.6 pH = 1.pdf                     pKb = 4.7 pOH = 4.7 + log 0.20  0.25 =4.6 pH = 1.pdf
pKb = 4.7 pOH = 4.7 + log 0.20 0.25 =4.6 pH = 1.pdf
 
Pouring the product on ice has two effects Firs.pdf
                     Pouring the product on ice has two effects  Firs.pdf                     Pouring the product on ice has two effects  Firs.pdf
Pouring the product on ice has two effects Firs.pdf
 
pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdf
                     pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdf                     pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdf
pH = pka + log ( [salt[[acid]) = 4.76 + log ( 0..pdf
 
NH3 is lewis base according to lewis electron pai.pdf
                     NH3 is lewis base according to lewis electron pai.pdf                     NH3 is lewis base according to lewis electron pai.pdf
NH3 is lewis base according to lewis electron pai.pdf
 
Li has high reduction potential than Cobalt ther.pdf
                     Li has high reduction potential than Cobalt  ther.pdf                     Li has high reduction potential than Cobalt  ther.pdf
Li has high reduction potential than Cobalt ther.pdf
 
Has two binding sites for oxygen .pdf
                     Has two binding sites for oxygen                 .pdf                     Has two binding sites for oxygen                 .pdf
Has two binding sites for oxygen .pdf
 
Types of physical situations or occurrencesIt is important to und.pdf
Types of physical situations or occurrencesIt is important to und.pdfTypes of physical situations or occurrencesIt is important to und.pdf
Types of physical situations or occurrencesIt is important to und.pdf
 
The term illegal acts, refers to violations of laws or governmental .pdf
The term illegal acts, refers to violations of laws or governmental .pdfThe term illegal acts, refers to violations of laws or governmental .pdf
The term illegal acts, refers to violations of laws or governmental .pdf
 
Strategic planning has long been used as a tool for transforming and.pdf
Strategic planning has long been used as a tool for transforming and.pdfStrategic planning has long been used as a tool for transforming and.pdf
Strategic planning has long been used as a tool for transforming and.pdf
 
Sorry I didnt get the question what you postSolutionSorry I .pdf
Sorry I didnt get the question what you postSolutionSorry I .pdfSorry I didnt get the question what you postSolutionSorry I .pdf
Sorry I didnt get the question what you postSolutionSorry I .pdf
 
delta H = 282.1 = 164.2 KJ .pdf
                     delta H = 282.1 = 164.2 KJ                      .pdf                     delta H = 282.1 = 164.2 KJ                      .pdf
delta H = 282.1 = 164.2 KJ .pdf
 
Sella turcica is the depression in the sphenoid bone of the skull. S.pdf
Sella turcica is the depression in the sphenoid bone of the skull. S.pdfSella turcica is the depression in the sphenoid bone of the skull. S.pdf
Sella turcica is the depression in the sphenoid bone of the skull. S.pdf
 
P(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdf
P(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdfP(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdf
P(child does not have a cavity) = (420)0.41 + (620)0.32 + (1020.pdf
 
Ans 1)Difference- DNA is double stranded where as RNA is single .pdf
Ans 1)Difference- DNA is double stranded where as RNA is single .pdfAns 1)Difference- DNA is double stranded where as RNA is single .pdf
Ans 1)Difference- DNA is double stranded where as RNA is single .pdf
 

Recently uploaded

Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
Climbers and Creepers used in landscaping
Climbers and Creepers used in landscapingClimbers and Creepers used in landscaping
Climbers and Creepers used in landscapingDr. M. Kumaresan Hort.
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 

Recently uploaded (20)

Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Climbers and Creepers used in landscaping
Climbers and Creepers used in landscapingClimbers and Creepers used in landscaping
Climbers and Creepers used in landscaping
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 

Hi, Please find my code.I have correted all of your classes.Plea.pdf

  • 1. Hi, Please find my code. I have correted all of your classes. Please let me know in case if do not get concpt. ######## Node.java ########### public class Node { private E element; private Node next; public Node() { this.element = null; this.next = null; } public Node(E e) { this.element = e; this.next = null; } public E getElement() { return this.element; } public void setElement(E element) { this.element= element; } public Node getNext() { return next; } public void setNext(Node next) { this.next = next; } } ########## Stack.java ############# public class Stack { private int N; private Node top;
  • 2. public Stack() { N = 0; this.top =null; } /* * places element on the top of the stack */ public void push(E element){ Node temp = new Node(element); temp.setNext(top); top = temp; N++; } /* * remove the top node and return its contents */ public E pop(){ if(top == null) return null; E e = top.getElement(); top = top.getNext(); N--; return e; } /* * Look at the top element of the Stack and return it, without removing */ public E peek(){ if(top == null) return null; return top.getElement(); }
  • 3. //returns the size of the stack public int size(){ return N; //replace } public boolean isEmpty(){ return top==null; } } ############ Queue.java ############ public class Queue { private Node front; private Node back; private int N; public Queue() { this.front = null; this.back = null; N = 0; } /* * places element in the back of the Queue */ public void enqueue(E element){ Node temp = new Node(element); if(front == null) { front = temp; back = temp; } else{ back.setNext(temp); back = temp; } N++;
  • 4. } /* * remove the front node of the queue and return it */ public E dequeue(){ if(front == null) { return null; } E item = front.getElement(); front = front.getNext(); // if we had only one element if(front == null){ back = null; } N--; return item; } /* * Look at the front of the queue and return it, without removing */ public E peek(){ if(back == null) return null; return back.getElement(); } //returns the size of the queue public int size(){ return N; } public boolean isEmpty(){ return front==null;
  • 5. } } ########### Palindrome.java ############ import java.util.Scanner; public class Palindrome { public static void main(String[ ] args) { Scanner input = new Scanner(System.in); String inputString; System.out.print("Please enter your string: "); inputString = input.next( ); if (isPalindrome( inputString )){ System.out.println("Yes it is a palindrome."); } else{ System.out.println("No this is not a palindrome."); } } public static boolean isPalindrome(String input) { Queue q = new Queue (); Stack s = new Stack (); char letter; int i; for (i = 0; i < input.length( ); i++) { letter = input.charAt(i); q.enqueue(letter); s.push(letter); } while (!q.isEmpty( )) { if (q.dequeue() != s.pop( )) return false; }
  • 6. return true; } } /* Sample Output: Please enter your string: MadaM Yes it is a palindrome. */ Solution Hi, Please find my code. I have correted all of your classes. Please let me know in case if do not get concpt. ######## Node.java ########### public class Node { private E element; private Node next; public Node() { this.element = null; this.next = null; } public Node(E e) { this.element = e; this.next = null; } public E getElement() { return this.element; } public void setElement(E element) { this.element= element; } public Node getNext() { return next; }
  • 7. public void setNext(Node next) { this.next = next; } } ########## Stack.java ############# public class Stack { private int N; private Node top; public Stack() { N = 0; this.top =null; } /* * places element on the top of the stack */ public void push(E element){ Node temp = new Node(element); temp.setNext(top); top = temp; N++; } /* * remove the top node and return its contents */ public E pop(){ if(top == null) return null; E e = top.getElement(); top = top.getNext(); N--; return e; }
  • 8. /* * Look at the top element of the Stack and return it, without removing */ public E peek(){ if(top == null) return null; return top.getElement(); } //returns the size of the stack public int size(){ return N; //replace } public boolean isEmpty(){ return top==null; } } ############ Queue.java ############ public class Queue { private Node front; private Node back; private int N; public Queue() { this.front = null; this.back = null; N = 0; } /* * places element in the back of the Queue */ public void enqueue(E element){ Node temp = new Node(element);
  • 9. if(front == null) { front = temp; back = temp; } else{ back.setNext(temp); back = temp; } N++; } /* * remove the front node of the queue and return it */ public E dequeue(){ if(front == null) { return null; } E item = front.getElement(); front = front.getNext(); // if we had only one element if(front == null){ back = null; } N--; return item; } /* * Look at the front of the queue and return it, without removing */ public E peek(){ if(back == null) return null;
  • 10. return back.getElement(); } //returns the size of the queue public int size(){ return N; } public boolean isEmpty(){ return front==null; } } ########### Palindrome.java ############ import java.util.Scanner; public class Palindrome { public static void main(String[ ] args) { Scanner input = new Scanner(System.in); String inputString; System.out.print("Please enter your string: "); inputString = input.next( ); if (isPalindrome( inputString )){ System.out.println("Yes it is a palindrome."); } else{ System.out.println("No this is not a palindrome."); } } public static boolean isPalindrome(String input) { Queue q = new Queue (); Stack s = new Stack (); char letter; int i; for (i = 0; i < input.length( ); i++)
  • 11. { letter = input.charAt(i); q.enqueue(letter); s.push(letter); } while (!q.isEmpty( )) { if (q.dequeue() != s.pop( )) return false; } return true; } } /* Sample Output: Please enter your string: MadaM Yes it is a palindrome. */