Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

pavarathyRock

@pavarathyRock
About
Posts
8
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C++ / Java
    P pavarathyRock

    Hey guys, I am now in a turning point in my career. Last 7 years I was working for a company as programmer, and I was working till now in C++. Then I have decided to leave it and try in other companies. search went well and I got offer in 2 companies.. Company 1 : It is leader in their technology, its a new domain for me, but that is okay with me. and the company review is good. The team seems pretty good. The programming language in which I have to work is again C++, in which I am pretty comfortable Company 2: It is a bigger organization. Technology is hot, salary is better than the other one. Company review is even better. But I have to work in Java. Do programming languages really matters? Should I reject company 2 only because of the programming language?

    The Lounge career c++ java collaboration question

  • Office Pranks
    P pavarathyRock

    I did prank only ones... took screen shot of desktop...and set it as wall paper. uncheck "show desktop items" option in arrange icons option. uncheck "Lock the taskBar" option in taskbar. pull the taskbar down to the screen..and enjoy...... :-D

    The Lounge

  • please suggest me some good pregram using datastructure.
    P pavarathyRock

    :) Yes satisfied, may be this is tooooo advanced for me. but I am gonna try it out..... :-D may be i can create an XML parser with high memory usage, then I can optimise it..... and other programs.....okey i will try.

    C / C++ / MFC data-structures c++

  • please suggest me some good pregram using datastructure.
    P pavarathyRock

    Hi Thanks for suggession, I have started on that. till now I have done this much for infix notation. The algorithm I have tried is "Shunting-yard algorithm". This program is having some problems, that I need to fix...... and you experts can give suggession in good coding practices also....

    //--------------------------------------------//

    //program.hpp
    #include<iostream>
    using namespace std;

    const int maxExpressionLength = 100;
    class stack
    {
    char data[maxExpressionLength];
    int top;
    public:
    stack();
    bool push(char input);
    bool pop(char & output);
    void print();
    };

    //--------------------------------------------//

    //------------------------------------------------------//
    //program.cpp
    #include "program.h"
    #include "ctype.h"

    stack::stack()
    {
    memset(data, 0, sizeof(data));
    top = -1;
    }
    bool stack::push(char input)
    {
    if (top >= maxExpressionLength - 1)
    {
    cout<<"Error : expression size is more than supported\n";
    return false;
    }
    top++;
    data[top] = input;
    return true;
    }

    bool stack::pop(char &output)
    {
    if (top <= -1)
    {
    //cout<<"Error : nothing to pop\n";
    return false;
    }

    output = data\[top--\];
    return true;
    

    }

    void stack::print()
    {
    if (top == -1)
    {
    return;
    }

    for (int i = 0; i <= top; i++)
    {
    	cout<<data\[i\]<<"  ";
    }
    

    }

    int strilen(int maxLength, char * string_data)
    {
    if (NULL == string_data)
    {
    return 0;
    }
    for (int i = 0; i < maxLength; i++)
    {
    if (string_data[i] == 0)
    {
    return i;
    }
    }
    return maxLength;
    }

    bool isValidOperator(char oper)
    {
    if ((oper == '^') || (oper == '*') || (oper == '/') || (oper == '+') || (oper == '-') || (oper == '(') || (oper == ')'))
    {
    return true;
    }
    else
    {
    return false;
    }
    }

    int presedence(char op1)
    {
    if (op1 == '^')
    {
    return 5;
    }
    else if ((op1 == '*') || (op1 == '/'))
    {
    return 4;
    }
    else if ((op1 == '+') || (op1 == '-'))
    {
    return 3;
    }
    else
    {
    return 0;
    }
    }

    int main()
    {
    char expression[maxExpressionLength + 1] = {0};

    cout<<"Enter the expression\\n";
    cin>>expression;
    //strcpy(expression, "3+4\*2/(1-5)^2^3");
    
    if (maxExpressionLength < strilen(maxExpressionLength + 1, expression))
    {
    	cout<<"Error : The size of expression is more than supported\["<<\_\_LINE\_\_<<"\]\\n";
    	getchar();
    	getchar();
    	return -1;
    }
    
    stack obj;
    
    char rpnOut\[maxExpressionLength + 1\] = {0};
    
    C / C++ / MFC data-structures c++

  • please suggest me some good pregram using datastructure.
    P pavarathyRock

    Hi Friends, I am now trying to learn C++ data structure. Can you guys suggest me some good programs so that I can try that out. Till now I have tried the program's like a dictionary with spell check(using Binary search tree), program to parse a file , create data structure and do some processing on that.......etc... please suggest me some questions like this... If the questions includes use of DS such as tree/LinkedList/graph etc.... then it will be very good.... Thanks in Advance... :)

    C / C++ / MFC data-structures c++

  • My Heap implementation is not working...please have a look frnds..
    P pavarathyRock

    :) :) Thanks herald for the help..... I think my implementation is correct. I have tried to print the heap as follows.

    int main()
    {
    int array[] = {14, 10, 1, 8, 7, 9, 3, 2, 4, 16};
    MyHeap h;
    h.print(array, 10);
    h.Build_Max_Heap(array, 10);
    cout<<"Initial Heap\n";
    h.print(array, 10);
    cout<

    It was giving the correct output.

    The main cause for this doubt is that I AM A FOOOL. I blindly believed the output given in the book.
    I didn't even try to print the output and check.......

    Thanks frnd thank you very much.....:thumbsup::thumbsup::thumbsup:

    and thanks for all others for your help.

    C / C++ / MFC database algorithms data-structures

  • My Heap implementation is not working...please have a look frnds..
    P pavarathyRock

    But here 16 / \ 14 9 / \ / \ 8 10 1 3 / \ / 2 4 7 10 is coming after 9 . As per heaps definition the root should contain largest element right..

    C / C++ / MFC database algorithms data-structures

  • My Heap implementation is not working...please have a look frnds..
    P pavarathyRock

    Hi Frnds, I am trying to do the heap implementation. I was following the algorithm explained in cormen....

    #include "MyHeap.h"
    void MyHeap::Build_Max_Heap(int * array, int length)
    {
    for (int i= (length/2); i>=0 ; i--)
    {
    Max_heapify(array, i, length);
    }
    }

    void MyHeap::Max_heapify(int * array, int index, int length)
    {
    int left = ((2 * index) + 1);
    int right = ((2 * index) + 2);
    int largest;
    if ((left <= length) && (array[left] > array[index]))
    {
    largest = left;
    }
    else
    {
    largest = index;
    }

    if ((right <= length) && (array\[right\] > array\[largest\]))
    {
    	largest = right;
    }
    
    if (largest != index)
    {
    	swap(array\[largest\], array\[index\]);
    	Max\_heapify(array, largest, length);
    }
    

    }

    void MyHeap::swap(int & a, int & b)
    {
    int c = a;
    a = b;
    b = c;
    }

    void MyHeap::print(int * array, int length)
    {
    for (int i = 0; i< length; i++)
    {
    cout<<array[i]<<"\t";
    }
    }

    int main()
    {
    int array[] = {14, 10, 1, 8, 7, 9, 3, 2, 4, 16};
    MyHeap h;
    h.print(array, 10);
    h.Build_Max_Heap(array, 10);
    h.print(array, 10);

    int x;
    cin>>x;
    return(0);
    

    }

    For some input it is working. For some it is not.. for the given input this is the output I am getting.. 16 14 9 8 10 1 3 2 4 7 Thanks in advance...

    C / C++ / MFC database algorithms data-structures
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups