SlideShare a Scribd company logo
1 of 2
Download to read offline
Java Assignment
Convert infix to postfix.
Solution
To convert infix expressions to postfix, we can use the stack data structure. The stack is used to
store the operators and parenthesis to apply the precedence.
For example if the input is a%b is ab%
class Stack
{
char c[]=new char[100];
int top=-1;
void push(char a)
{
try
{
c[++top]=a;
}
catch(StringIndexOutOfBoundsException e)
{
System.out.println("Stack full");
System.exit(0);
}
}
char pop()
{return c[top--];
}
boolean isEmpty()
{
return (top==-1)?true:false;
}
char peak()
{
return c[top];
}
}
public class InfixToPostfix
{
static Stack expression= new Stack;
public static void main(String argv[]) throws IOException
{
String infix;
BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));
System.out.print("enter the expression in infix notation");
infix=keyboard.readLine();
System.out.println("The resultant postfix expression is "+ toPostfix(infix));
}
private static String toPostfix(String infix)
{
char sym;
string postfix="";
for(int i=0;i

More Related Content

Similar to Java AssignmentConvert infix to postfix.SolutionTo convert i.pdf

Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdffathimafancyjeweller
 
Stack linked list
Stack linked listStack linked list
Stack linked listbhargav0077
 
Write a program to convert a given INFIX into POSTFIX. Make sure .pdf
Write a program to convert a given INFIX into POSTFIX. Make sure .pdfWrite a program to convert a given INFIX into POSTFIX. Make sure .pdf
Write a program to convert a given INFIX into POSTFIX. Make sure .pdfFOREVERPRODUCTCHD
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Ismar Silveira
 
Implement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfImplement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfSIGMATAX1
 
  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdf
  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdf  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdf
  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdfsudhirchourasia86
 
Bsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsBsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsRai University
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistAnton Arhipov
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsBtech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsRai University
 
Functions torage class and array and strings-
Functions torage class and array and strings-Functions torage class and array and strings-
Functions torage class and array and strings-aneebkmct
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arraystameemyousaf
 

Similar to Java AssignmentConvert infix to postfix.SolutionTo convert i.pdf (20)

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
Java ppt
Java pptJava ppt
Java ppt
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Stack linked list
Stack linked listStack linked list
Stack linked list
 
Write a program to convert a given INFIX into POSTFIX. Make sure .pdf
Write a program to convert a given INFIX into POSTFIX. Make sure .pdfWrite a program to convert a given INFIX into POSTFIX. Make sure .pdf
Write a program to convert a given INFIX into POSTFIX. Make sure .pdf
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4
 
Stack
StackStack
Stack
 
Container adapters
Container adaptersContainer adapters
Container adapters
 
Implement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfImplement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdf
 
Unit 3 stack
Unit   3 stackUnit   3 stack
Unit 3 stack
 
Stacks
StacksStacks
Stacks
 
  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdf
  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdf  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdf
  package Chapter_20;import ToolKit.PostfixNotation;import javaf.pdf
 
What is new in Java 8
What is new in Java 8What is new in Java 8
What is new in Java 8
 
Bsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsBsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and strings
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsBtech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and strings
 
Functions torage class and array and strings-
Functions torage class and array and strings-Functions torage class and array and strings-
Functions torage class and array and strings-
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
 
Java -lec-5
Java -lec-5Java -lec-5
Java -lec-5
 

More from jeetumordhani

• Sexual orientation is often framed on a binary-gay OR straight; ho.pdf
• Sexual orientation is often framed on a binary-gay OR straight; ho.pdf• Sexual orientation is often framed on a binary-gay OR straight; ho.pdf
• Sexual orientation is often framed on a binary-gay OR straight; ho.pdfjeetumordhani
 
You will need to develop a system that can track employee informatio.pdf
You will need to develop a system that can track employee informatio.pdfYou will need to develop a system that can track employee informatio.pdf
You will need to develop a system that can track employee informatio.pdfjeetumordhani
 
You heated the samples containing your cheek cells. Think carefully .pdf
You heated the samples containing your cheek cells. Think carefully .pdfYou heated the samples containing your cheek cells. Think carefully .pdf
You heated the samples containing your cheek cells. Think carefully .pdfjeetumordhani
 
write at least 3 virulence factors for staph, strep A, strep B, .pdf
write at least 3 virulence factors for staph, strep A, strep B, .pdfwrite at least 3 virulence factors for staph, strep A, strep B, .pdf
write at least 3 virulence factors for staph, strep A, strep B, .pdfjeetumordhani
 
Why have rodents been spectacularly successful What role do you thi.pdf
Why have rodents been spectacularly successful What role do you thi.pdfWhy have rodents been spectacularly successful What role do you thi.pdf
Why have rodents been spectacularly successful What role do you thi.pdfjeetumordhani
 
Who writes the ethical codeSolutionThe Code of Ethics states .pdf
Who writes the ethical codeSolutionThe Code of Ethics states .pdfWho writes the ethical codeSolutionThe Code of Ethics states .pdf
Who writes the ethical codeSolutionThe Code of Ethics states .pdfjeetumordhani
 
Which of these studies might be analyzed with a correlationThe wh.pdf
Which of these studies might be analyzed with a correlationThe wh.pdfWhich of these studies might be analyzed with a correlationThe wh.pdf
Which of these studies might be analyzed with a correlationThe wh.pdfjeetumordhani
 
Which of the following statements about instant messaging is incorre.pdf
Which of the following statements about instant messaging is incorre.pdfWhich of the following statements about instant messaging is incorre.pdf
Which of the following statements about instant messaging is incorre.pdfjeetumordhani
 
Which of the following is not a property of a normal curve A. Bell .pdf
Which of the following is not a property of a normal curve A. Bell .pdfWhich of the following is not a property of a normal curve A. Bell .pdf
Which of the following is not a property of a normal curve A. Bell .pdfjeetumordhani
 
What tissue type has polarity and is avascular What tissue.pdf
What tissue type has polarity and is avascular  What tissue.pdfWhat tissue type has polarity and is avascular  What tissue.pdf
What tissue type has polarity and is avascular What tissue.pdfjeetumordhani
 
What organizations are involved in Internet2How is this developme.pdf
What organizations are involved in Internet2How is this developme.pdfWhat organizations are involved in Internet2How is this developme.pdf
What organizations are involved in Internet2How is this developme.pdfjeetumordhani
 
What is meant by modular software and why is it important How can t.pdf
What is meant by modular software and why is it important  How can t.pdfWhat is meant by modular software and why is it important  How can t.pdf
What is meant by modular software and why is it important How can t.pdfjeetumordhani
 
What are the two major steps in biological classification What .pdf
What are the two major steps in biological classification  What .pdfWhat are the two major steps in biological classification  What .pdf
What are the two major steps in biological classification What .pdfjeetumordhani
 
Tissue transplant rejection is primarily atype I reaction.type I.pdf
Tissue transplant rejection is primarily atype I reaction.type I.pdfTissue transplant rejection is primarily atype I reaction.type I.pdf
Tissue transplant rejection is primarily atype I reaction.type I.pdfjeetumordhani
 
The members of the UN peace committee, must choose, from among thems.pdf
The members of the UN peace committee, must choose, from among thems.pdfThe members of the UN peace committee, must choose, from among thems.pdf
The members of the UN peace committee, must choose, from among thems.pdfjeetumordhani
 
NetWork Design Question1a.) In writing a letter to a Friend, what .pdf
NetWork Design Question1a.) In writing a letter to a Friend, what .pdfNetWork Design Question1a.) In writing a letter to a Friend, what .pdf
NetWork Design Question1a.) In writing a letter to a Friend, what .pdfjeetumordhani
 
Please help me with thisLet x denote a single observation of a no.pdf
Please help me with thisLet x denote a single observation of a no.pdfPlease help me with thisLet x denote a single observation of a no.pdf
Please help me with thisLet x denote a single observation of a no.pdfjeetumordhani
 
Numerical Methods yi + 1 = y_i + Phi (x_i, y_i, h) Consider the equ.pdf
Numerical Methods yi + 1 = y_i + Phi (x_i, y_i, h)  Consider the equ.pdfNumerical Methods yi + 1 = y_i + Phi (x_i, y_i, h)  Consider the equ.pdf
Numerical Methods yi + 1 = y_i + Phi (x_i, y_i, h) Consider the equ.pdfjeetumordhani
 
My question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdfMy question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdfjeetumordhani
 
Irreducible polynomials over a field F play a similar, in a certain .pdf
Irreducible polynomials over a field F play a similar, in a certain .pdfIrreducible polynomials over a field F play a similar, in a certain .pdf
Irreducible polynomials over a field F play a similar, in a certain .pdfjeetumordhani
 

More from jeetumordhani (20)

• Sexual orientation is often framed on a binary-gay OR straight; ho.pdf
• Sexual orientation is often framed on a binary-gay OR straight; ho.pdf• Sexual orientation is often framed on a binary-gay OR straight; ho.pdf
• Sexual orientation is often framed on a binary-gay OR straight; ho.pdf
 
You will need to develop a system that can track employee informatio.pdf
You will need to develop a system that can track employee informatio.pdfYou will need to develop a system that can track employee informatio.pdf
You will need to develop a system that can track employee informatio.pdf
 
You heated the samples containing your cheek cells. Think carefully .pdf
You heated the samples containing your cheek cells. Think carefully .pdfYou heated the samples containing your cheek cells. Think carefully .pdf
You heated the samples containing your cheek cells. Think carefully .pdf
 
write at least 3 virulence factors for staph, strep A, strep B, .pdf
write at least 3 virulence factors for staph, strep A, strep B, .pdfwrite at least 3 virulence factors for staph, strep A, strep B, .pdf
write at least 3 virulence factors for staph, strep A, strep B, .pdf
 
Why have rodents been spectacularly successful What role do you thi.pdf
Why have rodents been spectacularly successful What role do you thi.pdfWhy have rodents been spectacularly successful What role do you thi.pdf
Why have rodents been spectacularly successful What role do you thi.pdf
 
Who writes the ethical codeSolutionThe Code of Ethics states .pdf
Who writes the ethical codeSolutionThe Code of Ethics states .pdfWho writes the ethical codeSolutionThe Code of Ethics states .pdf
Who writes the ethical codeSolutionThe Code of Ethics states .pdf
 
Which of these studies might be analyzed with a correlationThe wh.pdf
Which of these studies might be analyzed with a correlationThe wh.pdfWhich of these studies might be analyzed with a correlationThe wh.pdf
Which of these studies might be analyzed with a correlationThe wh.pdf
 
Which of the following statements about instant messaging is incorre.pdf
Which of the following statements about instant messaging is incorre.pdfWhich of the following statements about instant messaging is incorre.pdf
Which of the following statements about instant messaging is incorre.pdf
 
Which of the following is not a property of a normal curve A. Bell .pdf
Which of the following is not a property of a normal curve A. Bell .pdfWhich of the following is not a property of a normal curve A. Bell .pdf
Which of the following is not a property of a normal curve A. Bell .pdf
 
What tissue type has polarity and is avascular What tissue.pdf
What tissue type has polarity and is avascular  What tissue.pdfWhat tissue type has polarity and is avascular  What tissue.pdf
What tissue type has polarity and is avascular What tissue.pdf
 
What organizations are involved in Internet2How is this developme.pdf
What organizations are involved in Internet2How is this developme.pdfWhat organizations are involved in Internet2How is this developme.pdf
What organizations are involved in Internet2How is this developme.pdf
 
What is meant by modular software and why is it important How can t.pdf
What is meant by modular software and why is it important  How can t.pdfWhat is meant by modular software and why is it important  How can t.pdf
What is meant by modular software and why is it important How can t.pdf
 
What are the two major steps in biological classification What .pdf
What are the two major steps in biological classification  What .pdfWhat are the two major steps in biological classification  What .pdf
What are the two major steps in biological classification What .pdf
 
Tissue transplant rejection is primarily atype I reaction.type I.pdf
Tissue transplant rejection is primarily atype I reaction.type I.pdfTissue transplant rejection is primarily atype I reaction.type I.pdf
Tissue transplant rejection is primarily atype I reaction.type I.pdf
 
The members of the UN peace committee, must choose, from among thems.pdf
The members of the UN peace committee, must choose, from among thems.pdfThe members of the UN peace committee, must choose, from among thems.pdf
The members of the UN peace committee, must choose, from among thems.pdf
 
NetWork Design Question1a.) In writing a letter to a Friend, what .pdf
NetWork Design Question1a.) In writing a letter to a Friend, what .pdfNetWork Design Question1a.) In writing a letter to a Friend, what .pdf
NetWork Design Question1a.) In writing a letter to a Friend, what .pdf
 
Please help me with thisLet x denote a single observation of a no.pdf
Please help me with thisLet x denote a single observation of a no.pdfPlease help me with thisLet x denote a single observation of a no.pdf
Please help me with thisLet x denote a single observation of a no.pdf
 
Numerical Methods yi + 1 = y_i + Phi (x_i, y_i, h) Consider the equ.pdf
Numerical Methods yi + 1 = y_i + Phi (x_i, y_i, h)  Consider the equ.pdfNumerical Methods yi + 1 = y_i + Phi (x_i, y_i, h)  Consider the equ.pdf
Numerical Methods yi + 1 = y_i + Phi (x_i, y_i, h) Consider the equ.pdf
 
My question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdfMy question is pretty simple, I just want to know how to call my ope.pdf
My question is pretty simple, I just want to know how to call my ope.pdf
 
Irreducible polynomials over a field F play a similar, in a certain .pdf
Irreducible polynomials over a field F play a similar, in a certain .pdfIrreducible polynomials over a field F play a similar, in a certain .pdf
Irreducible polynomials over a field F play a similar, in a certain .pdf
 

Recently uploaded

SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
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
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
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
 
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
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Đề 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
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 

Recently uploaded (20)

SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
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
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
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
 
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...
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Đề 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
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 

Java AssignmentConvert infix to postfix.SolutionTo convert i.pdf

  • 1. Java Assignment Convert infix to postfix. Solution To convert infix expressions to postfix, we can use the stack data structure. The stack is used to store the operators and parenthesis to apply the precedence. For example if the input is a%b is ab% class Stack { char c[]=new char[100]; int top=-1; void push(char a) { try { c[++top]=a; } catch(StringIndexOutOfBoundsException e) { System.out.println("Stack full"); System.exit(0); } } char pop() {return c[top--]; } boolean isEmpty() { return (top==-1)?true:false; } char peak() { return c[top]; }
  • 2. } public class InfixToPostfix { static Stack expression= new Stack; public static void main(String argv[]) throws IOException { String infix; BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in)); System.out.print("enter the expression in infix notation"); infix=keyboard.readLine(); System.out.println("The resultant postfix expression is "+ toPostfix(infix)); } private static String toPostfix(String infix) { char sym; string postfix=""; for(int i=0;i