Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

SIKSHAPATH

SIKSHAPATH Logo SIKSHAPATH Logo

SIKSHAPATH Navigation

  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
Home/Comments/Page 194
  1. Asked: October 16, 2021In: Data Structure

    Draw the stack structure in each case when the following operations are performed on an empty stack.

    Professor
    Professor
    Added an answer on October 17, 2021 at 12:47 pm

    DOWNLOAD ATTACHMENT FOR ANSWER:

    DOWNLOAD ATTACHMENT FOR ANSWER:

    See less
    Attachment

      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  2. Asked: October 17, 2021In: Data Structure

    Using Stack, convert the given in-fix expression into post-fix notation. ((x-y)*z) / (x-(y/z)) – (v??/?? – ??) Evaluate post-fix notation if x=16, y=4, z=1. Note: Display all algorithmic steps sequence wise

    Professor
    Professor
    Added an answer on October 17, 2021 at 12:43 am
    This answer was edited.

      Only Q1 answer is here. Download attachment for answer.

     

    Only Q1 answer is here.

    Download attachment for answer.

    See less
    Attachment

      • 1
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  3. Asked: October 16, 2021In: Data Structure

    Using Stack, convert the given in-fix expression into post-fix notation. ((x-y)*z) / (x-(y/z)) – (v??/?? – ??) Evaluate post-fix notation if x=16, y=4, z=1. Note: Display all algorithmic steps sequence wise

    Professor
    Professor
    Added an answer on October 16, 2021 at 9:16 pm
    This answer was edited.

    DOWNLOAD ATTACHMENT FOR ANSWER. ALSO CHECK FOR INFIX EXPRESSION IS SAME OR NOT.

    DOWNLOAD ATTACHMENT FOR ANSWER.

    ALSO CHECK FOR INFIX EXPRESSION IS SAME OR NOT.

    See less
    Attachment

      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  4. Asked: October 16, 2021In: Programming Language

    create an employee object having properties name, date of birth, department, designation and salary. let the employee class have appropriate getter/setters methods for accessing these properties. initialize these properties through the setter methods. store this object into a file “outobject.txt”. read the same object from the same file and display its properties through getter methods.

    Professor
    Best Answer
    Professor
    Added an answer on October 16, 2021 at 10:21 am

    Answer is in worksheet(attachement)  file

    Answer is in worksheet(attachement)  file

    See less
    Attachment

      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  5. Asked: October 16, 2021In: Programming Language

    Create two threads, one thread to display all even numbers between 1 & 20, another to display odd numbers between 1 & 20. Note: Display all even numbers followed by odd numbers Hint: use join

    Professor
    Professor
    Added an answer on October 16, 2021 at 10:03 am

    public class Main { public static void main(String[] args) { Runnable r = new Runnable1(); Thread t = new Thread(r); t.start(); Runnable r2 = new Runnable2(); Thread t2 = new Thread(r2); t2.start(); } } class Runnable2 implements Runnable{ public void run(){ for(int i=1;i<=20;i++){ if(i%2 == 1) SRead more

    public class Main {

    public static void main(String[] args) {
    Runnable r = new Runnable1();
    Thread t = new Thread(r);
    t.start();
    Runnable r2 = new Runnable2();
    Thread t2 = new Thread(r2);
    t2.start();
    }
    }

    class Runnable2 implements Runnable{
    public void run(){
    for(int i=1;i<=20;i++){
    if(i%2 == 1)
    System.out.println(i);
    }
    }
    }

    class Runnable1 implements Runnable{
    public void run(){
    for(int i=1;i<=20;i++){
    if(i%2 == 0)
    System.out.println(i);
    }
    }
    }

    See less
      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  6. Asked: October 14, 2021In: Data Structure

    Write a program to convert the expression “a+b” into “ab+”.

    Professor
    Professor
    Added an answer on October 14, 2021 at 5:58 am
    This answer was edited.

    /* C++ implementation to convertinfix expression to postfix*/#include<bits/stdc++.h>using namespace std;//Function to return precedence of operatorsint prec(char c) {if(c == '^')return 3;else if(c == '/' || c=='*')return 2;else if(c == '+' || c == '-')return 1;elsereturn -1;}// The main functiRead more

    /* C++ implementation to convert
    infix expression to postfix*/

    #include<bits/stdc++.h>
    using namespace std;

    //Function to return precedence of operators
    int prec(char c) {
    if(c == '^')
    return 3;
    else if(c == '/' || c=='*')
    return 2;
    else if(c == '+' || c == '-')
    return 1;
    else
    return -1;
    }

    // The main function to convert infix expression
    //to postfix expression
    void infixToPostfix(string s) {

    stack<char> st; //For stack operations, we are using C++ built in stack
    string result;

    for(int i = 0; i < s.length(); i++) {
    char c = s[i];

    // If the scanned character is
    // an operand, add it to output string.
    if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))
    result += c;

    // If the scanned character is an
    // ‘(‘, push it to the stack.
    else if(c == '(')
    st.push('(');

    // If the scanned character is an ‘)’,
    // pop and to output string from the stack
    // until an ‘(‘ is encountered.
    else if(c == ')') {
    while(st.top() != '(')
    {
    result += st.top();
    st.pop();
    }
    st.pop();
    }

    //If an operator is scanned
    else {
    while(!st.empty() && prec(s[i]) <= prec(st.top())) {
    result += st.top();
    st.pop();
    }
    st.push(c);
    }
    }

    // Pop all the remaining elements from the stack
    while(!st.empty()) {
    result += st.top();
    st.pop();
    }

    cout << result << endl;
    }

    //Driver program to test above functions
    int main() {
    string exp = "a+b";
    infixToPostfix(exp);
    return 0;
    }
    See less
      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
1 … 192 193 194

Sidebar

store ads

Stats

  • Questions 1k
  • Answers 1k
  • Posts 149
  • Best Answers 89
  • This Free AI Tool Translates Entire Books in Minute !
  • AI News: 🎬 Hollywood’s AI Studios, 🎓 OpenAI’s Latest Gift to Educators, 🚚 Class8 Bags $22M, 🧠 Google Gemini’s Memory Upgrade
  • AI NEWS: Legal Action Against OpenAI, $16M Paid, & Elon Musk’s Praise from Investor 🤖💰📑 | AI Boosts Cloud Seeding for Water Security 🌱💧
  • AI News: 🎬AI Video Tool Scam Exposed🤯, 🛰️ AI-Powered Drones to Ukraine 😱, Google’s $20M AI Push, Sam Altman Joins SF’s Leadership Team
  • AI News: 🤝 Biden Meets Xi on AI Talks, 💡 Xavier Niel’s Advice for Europe, ♻️ Hong Kong’s Smart Bin Revolution, 🚀 AI x Huawei

Explore

  • Recent Questions
  • Questions For You
  • Answers With Time
  • Most Visited
  • New Questions
  • Recent Questions With Time

Footer

SIKSHAPATH

Helpful Links

  • Contact
  • Disclaimer
  • Privacy Policy Notice
  • TERMS OF USE
  • FAQs
  • Refund/Cancellation Policy
  • Delivery Policy for Sikshapath

Follow Us

© 2021-24 Sikshapath. All Rights Reserved