Reply
Page 12 of 25 FirstFirst ... 2 10 11 12 13 14 22 ... LastLast
Results 331 to 360 of 749
  1. #331
    ... Illuslon's Avatar
    Join Date: Mar 2011
    Age: 33
    Posts: 592
    Rep Power: 374
    Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50) Illuslon will become famous soon enough. (+50)
    Illuslon is offline
    Is that the printer he throws out the window ???

    I literally watched that over and over and couldn't stop laughing

    edit: I couldn't quote the gif because I don't have enough posts but its the one A_Hard_Rain posted.
    Reply With Quote

  2. #332
    ♦ ɴɣϲ ϲrew ♦ Phenom01's Avatar
    Join Date: Jul 2005
    Location: Manhattan, New York
    Age: 35
    Posts: 4,986
    Rep Power: 5083
    Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500)
    Phenom01 is offline
    I think some people are confused here. There are different paths in programming. There is software development for business or clients which doesn't require you to know all those algorithms and then there are software engineers A.K.A architects that come up with the algorithms. There are different level of duties. You can be a programmer but are only require to write the logic or classes of the program. Then there is a programmer whos duty is to implement these classes.
    ****************************
    * MISC IT expert *
    * Ron Paul for president!! *
    ****************************
    Reply With Quote

  3. #333
    Registered User Boatski's Avatar
    Join Date: Jul 2009
    Age: 36
    Posts: 4,994
    Rep Power: 6138
    Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000)
    Boatski is offline
    Originally Posted by Phenom01 View Post
    I think some people are confused here. There are different paths in programming. There is software development for business or clients which doesn't require you to know all those algorithms and then there are software engineers A.K.A architects that come up with the algorithms. There are different level of duties. You can be a programmer but are only require to write the logic or classes of the program. Then there is a programmer whos duty is to implement these classes.
    There are different paths in Computer Science. You basically have:
    Web development
    Software development
    Databases

    These all kind of intertwine a bit, but also have their own things. Not everyone is going to do it all in the job world, like you mentioned.

    If you're implying that the thread has railed off, then I believe that this is a general place where someone can ask for help and for those of us with similar interests to chat.
    Hide yo kids, hide yo wife.
    Reply With Quote

  4. #334
    Joe Soap EasTexan's Avatar
    Join Date: Jul 2009
    Location: Texas, United States
    Age: 35
    Posts: 3,248
    Rep Power: 3885
    EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500)
    EasTexan is offline
    What are your thoughts on graduate school? I'm seriously considering applying to Texas A&M's graduate program to earn either a masters of engineering in computer engineering or a masters of computer science. Both are non-thesis routes.

    I feel like my B.S. is just barely scratching the surface and would like to really dive into the deeper, more interesting topics and research. I have 20hrs left in my B.S. so maybe I'll be more fulfilled when I'm done, we'll see.

    Originally Posted by Mbalz-Iz-Hari View Post
    The nth last element/node.

    I probably should have said given a singly-linked list and an integer "n".

    For example:

    Input:
    - pointer to the head of a singly-linked list
    - 42

    Output:
    pointer to the 42nd element/node counting from the end of the list.
    Aha, gotcha.

    Sudocode-kinda:

    nthFromEnd(E head,int n){

    finalNode = head.next;
    prodeNode = head.next;
    int count = 0;

    while(count < n){
    probeNode = probeNode.next;
    count++;
    }

    while(probeNode.next != null){
    probeNode = probeNode.next;
    finalNode = finalNode.next;
    }

    return finalNode;
    }
    Last edited by EasTexan; 04-05-2011 at 08:56 PM.
    Reply With Quote

  5. #335
    Registered User Boatski's Avatar
    Join Date: Jul 2009
    Age: 36
    Posts: 4,994
    Rep Power: 6138
    Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000)
    Boatski is offline
    Originally Posted by EasTexan View Post
    What are your thoughts on graduate school? I'm seriously considering applying to Texas A&M's graduate program to earn either a masters of engineering in computer engineering or a masters of computer science. Both are non-thesis routes.

    I feel like my B.S. is just barely scratching the surface and would like to really dive into the deeper, more interesting topics and research. I have 20hrs left in my B.S. so maybe I'll be more fulfilled when I'm done, we'll see.
    My school offers a masters program in CS. It's something I've thought about, but nothing I've really looked into yet.
    Hide yo kids, hide yo wife.
    Reply With Quote

  6. #336
    The voice of reason. Mbalz-Iz-Hari's Avatar
    Join Date: Dec 2009
    Location: Toronto, Ontario, Canada
    Posts: 454
    Rep Power: 289
    Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50)
    Mbalz-Iz-Hari is offline
    Originally Posted by Phenom01 View Post
    I think some people are confused here. There are different paths in programming. There is software development for business or clients which doesn't require you to know all those algorithms and then there are software engineers A.K.A architects that come up with the algorithms. There are different level of duties. You can be a programmer but are only require to write the logic or classes of the program. Then there is a programmer whos duty is to implement these classes.
    That may be true, but I personally do not know any top software companies that doesn't ask basic data structure/algorithm problems during interviews. Sure anyone can hack out code once they learn the syntax, but that's just scratching the surface without fully appreciating the science behind how things work. Plus knowing and implementing basic data structures will improve the speed of your program by many magnitudes.

    If that's not your style, then by all means.

    Originally Posted by EasTexan View Post
    Aha, gotcha.

    Sudocode-kinda:

    nthFromEnd(E head,int n){

    finalNode = head.next; // should really just point to head and not head.next since head.next right off the bat might be a null reference if your list has only 1 node
    prodeNode = head.next; // should really just point to head and not head.next
    int count = 0; //should start count at 1 here. eg, if my input for n is 1, you actually want to return the last element and not the second last element. Draw it out, you'll see what I mean.

    while(count < n){
    probeNode = probeNode.next;
    count++;
    }

    while(probeNode.next /*should just be probeNode*/ != null){
    probeNode = probeNode.next;
    finalNode = finalNode.next;
    }

    return finalNode;
    }
    Logic is correct, except for the index-off by one dreaded mistake we all make.

    Dost thou dare tackle the binary tree problem?
    Misc Engineering & Photography Crew
    Reply With Quote

  7. #337
    Joe Soap EasTexan's Avatar
    Join Date: Jul 2009
    Location: Texas, United States
    Age: 35
    Posts: 3,248
    Rep Power: 3885
    EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500) EasTexan is a glorious beacon of knowledge. (+2500)
    EasTexan is offline
    Originally Posted by Mbalz-Iz-Hari View Post
    Logic is correct, except for the index-off by one dreaded mistake we all make.
    Aha, several silly mistakes. I wrote that out in less than 2mins and only drew out one case... didn't even consider n=1. At least the logic is almost correct. prodeNode should be probeNode... typo.

    I will tackle the binary tree tomorrow after class. I took a break from studying Taylor and Maclaurin series crap in calc II to post my try at the linked-list problem. And just now to reply, haha. Back to studying. (I'm scared of that binary tree question tbh... :P)
    Reply With Quote

  8. #338
    ♦ ɴɣϲ ϲrew ♦ Phenom01's Avatar
    Join Date: Jul 2005
    Location: Manhattan, New York
    Age: 35
    Posts: 4,986
    Rep Power: 5083
    Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500)
    Phenom01 is offline
    at my interview with *** they did not ask me to write any algorithms. The only thing close to an algorithm they asked me to do is a loop where it sets all elements in an array with values and displays it. I work at Bloomberg towers (one of the biggest financial firm) and they never asked me to write any algorithm. I just think people are confused on the different types of programming.
    ****************************
    * MISC IT expert *
    * Ron Paul for president!! *
    ****************************
    Reply With Quote

  9. #339
    The voice of reason. Mbalz-Iz-Hari's Avatar
    Join Date: Dec 2009
    Location: Toronto, Ontario, Canada
    Posts: 454
    Rep Power: 289
    Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50)
    Mbalz-Iz-Hari is offline
    Originally Posted by Phenom01 View Post
    at my interview with *** they did not ask me to write any algorithms. The only thing close to an algorithm they asked me to do is a loop where it sets all elements in an array with values and displays it. I work at Bloomberg towers (one of the biggest financial firm) and they never asked me to write any algorithm. I just think people are confused on the different types of programming.
    Well sh!t, I guess all these people got punk'd by Bloomberg then!

    http://www.glassdoor.com/Interview/B...O14,42_IP2.htm

    I think you're the only one confused here.
    Misc Engineering & Photography Crew
    Reply With Quote

  10. #340
    Registered User Boatski's Avatar
    Join Date: Jul 2009
    Age: 36
    Posts: 4,994
    Rep Power: 6138
    Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000)
    Boatski is offline
    Originally Posted by Phenom01 View Post
    at my interview with *** they did not ask me to write any algorithms. The only thing close to an algorithm they asked me to do is a loop where it sets all elements in an array with values and displays it. I work at Bloomberg towers (one of the biggest financial firm) and they never asked me to write any algorithm. I just think people are confused on the different types of programming.
    A loop is still an algorithm, but mbalz pretty much summed it up.

    Originally Posted by Mbalz-Iz-Hari View Post
    Well sh!t, I guess all these people got punk'd by Bloomberg then!

    http://www.glassdoor.com/Interview/B...O14,42_IP2.htm

    I think you're the only one confused here.
    nice site, never knew about it.
    Hide yo kids, hide yo wife.
    Reply With Quote

  11. #341
    Registered User C411911's Avatar
    Join Date: Sep 2010
    Age: 40
    Posts: 5,291
    Rep Power: 4369
    C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500) C411911 is a glorious beacon of knowledge. (+2500)
    C411911 is offline
    i got an assignment to write for my C class tomorrow dealing with Arrays and i struggle with arrays so C programmers ill fukn rep you for life if you help me out when I need help srs.

    Ill be able to get most of it just some help here and there
    █▀▄ █▀▀ ▄▀▀ ▀░░▄▀▀░ █░█ ▀▄░▄▀░░▄▀ █▀▀▄ █▀▀ █░░░█
    █░█ █▀▀ ░▀▄ █░░█░▀▌ █░█ ░░█░░░░█░ █▐█▀ █▀▀ █░█░█
    ▀▀░ ▀▀▀ ▀▀░ ▀░░▀▀▀░ ░▀░ ░░▀░░░░░▀ ▀░▀▀ ▀▀▀ ░▀░▀░
    Reply With Quote

  12. #342
    Registered User FuzzeWuzze's Avatar
    Join Date: Apr 2010
    Location: Oregon, United States
    Age: 42
    Posts: 8,196
    Rep Power: 3178
    FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500) FuzzeWuzze is a glorious beacon of knowledge. (+2500)
    FuzzeWuzze is offline
    Saw this and had to post it in this thread.

    The internet is amazing lololol...
    Join KIVA - Donate to those in need around the world! Free $25 for signing up!
    http://www.kiva.org/invitedby/fuzzewuzze

    Join the League of Legends! Largest MOBA Game of all time!
    http://signup.leagueoflegends.com/?ref=4abffc9d33310
    Reply With Quote

  13. #343
    Registered User LessTalk's Avatar
    Join Date: Oct 2010
    Age: 31
    Posts: 178
    Rep Power: 277
    LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50) LessTalk will become famous soon enough. (+50)
    LessTalk is offline
    Looking for someone good at PHP or Ruby or JavaScript to make a quick script for me. I have a link to exactly what I want. PM me, it'll take less than an hour but if you can help I'll pay you enough for a McDonalds combo or something.
    Reply With Quote

  14. #344
    Registered User Boatski's Avatar
    Join Date: Jul 2009
    Age: 36
    Posts: 4,994
    Rep Power: 6138
    Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000) Boatski is a name known to all. (+5000)
    Boatski is offline
    http://usesthis.com/archives/ cool website to read about what other devs use, etc.
    Hide yo kids, hide yo wife.
    Reply With Quote

  15. #345
    Registered User Shattering Fast's Avatar
    Join Date: Nov 2002
    Location: Los Angeles, California, United States
    Age: 36
    Posts: 1,624
    Rep Power: 2739
    Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000) Shattering Fast is just really nice. (+1000)
    Shattering Fast is offline
    So I'm working through "How to Think Like a Computer Scientist: Learning with Python" and I'm having trouble with a very basic script lol. I want to prompt the user to set the background color, turtle color and pen width, but I keep getting an error when i try to run the script about the color string not being defined. The Turtle library is supposed to have definitions for these colors, but maybe I'm missing a step. Here's my code:

    Code:
    import turtle
    
    color_bg = str(input("What color do you want the background to be? "))
    color_tess = str(input("What color do you want Tess to be? "))
    width_tesspen = int(input("How wide should Tess' pen be? "))
    
    wn = turtle.Screen()
    wn.bgcolor(color_bg)         # set the window background color
    wn.title("Hello, Tess!")         # set the window title
    
    tess = turtle.Turtle()
    tess.color(color_tess)               # make tess blue
    tess.pensize(width_tesspen)                  # set the width of her pen
    
    tess.forward(50)
    tess.left(120)
    tess.forward(50)
    
    wn.exitonclick()
    Reply With Quote

  16. #346
    The voice of reason. Mbalz-Iz-Hari's Avatar
    Join Date: Dec 2009
    Location: Toronto, Ontario, Canada
    Posts: 454
    Rep Power: 289
    Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50)
    Mbalz-Iz-Hari is offline
    Originally Posted by Shattering Fast View Post
    So I'm working through "How to Think Like a Computer Scientist: Learning with Python" and I'm having trouble with a very basic script lol. I want to prompt the user to set the background color, turtle color and pen width, but I keep getting an error when i try to run the script about the color string not being defined. The Turtle library is supposed to have definitions for these colors, but maybe I'm missing a step. Here's my code:

    Code:
    import turtle
    
    color_bg = str(input("What color do you want the background to be? "))
    color_tess = str(input("What color do you want Tess to be? "))
    width_tesspen = int(input("How wide should Tess' pen be? "))
    
    wn = turtle.Screen()
    wn.bgcolor(color_bg)         # set the window background color
    wn.title("Hello, Tess!")         # set the window title
    
    tess = turtle.Turtle()
    tess.color(color_tess)               # make tess blue
    tess.pensize(width_tesspen)                  # set the width of her pen
    
    tess.forward(50)
    tess.left(120)
    tess.forward(50)
    
    wn.exitonclick()
    What color are you inputting, and what colors are available in the turtle library?
    Misc Engineering & Photography Crew
    Reply With Quote

  17. #347
    Registered User lems's Avatar
    Join Date: Oct 2007
    Age: 36
    Posts: 1,844
    Rep Power: 0
    lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250)
    lems is offline
    Originally Posted by Mbalz-Iz-Hari View Post
    No takers on the binary tree question? I'll post solutions on the next page.

    Here's another one:

    Given a singly-linked-list, write an efficient algorithm that returns the n-th last element of the list.
    function build hashmap(head, n){
    hashmap m = new HashMap()
    for(int i = 0; i < head.length; i++){
    m[i] = head.val
    }
    return m;
    }

    print m[n]

    here's another optimization. If the algorithm needs to lookup the N'th node from the same tree, this will make lookups fast. The trade off here is memory. Memory is cheap tho and time isn't.

    There are a lot of interview questions that require a hashmap. I've been interviewed by pretty much every big web tech company and a lot of the questions involve making a typical N^2 algorithm into a O(N) algorithm.

    for example:

    given an array of numbers and a number, find all the numbers in the array that add up to the given number
    Reply With Quote

  18. #348
    The voice of reason. Mbalz-Iz-Hari's Avatar
    Join Date: Dec 2009
    Location: Toronto, Ontario, Canada
    Posts: 454
    Rep Power: 289
    Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50)
    Mbalz-Iz-Hari is offline
    Originally Posted by lems View Post
    function build hashmap(head, n){
    hashmap m = new HashMap()
    for(int i = 0; i < head.length; i++){
    m[i] = head.val
    }
    return m;
    }

    print m[n]

    here's another optimization. If the algorithm needs to lookup the N'th node from the same tree, this will make lookups fast. The trade off here is memory. Memory is cheap tho and time isn't.
    1. We're looking for the n-th LAST node. If we're looking at the n-th node, then the problem is trivial.

    2. Hashmap?! I think you're really just implementing an array in your code. No need for the hash function overhead and extra space. Also, you can't index a Hashmap like an array unless you use a Sorted Hashmap/Dictionary, which implements AVL trees underneath the hood, and actually has a different run time compared to a normal Hashmap (albeit not too too significant for a reasonable input size). Only useful if repeated queries are required of the n-th last node, otherwise, this can be solved in-place, which has been posted already.

    3. In your implementation head.val never gets changed. Why would you even need the value? The question is asking a reference to the node itself.

    There are a lot of interview questions that require a hashmap. I've been interviewed by pretty much every big web tech company and a lot of the questions involve making a typical N^2 algorithm into a O(N) algorithm.

    for example:

    given an array of numbers and a number, find all the numbers in the array that add up to the given number
    Code:
    void OutputNumbers(int[] a, int sum)
    {
        Dictionary<int, int> d = new Dictionary<int, int>();
        foreach(int num in a)
        {
            if (!d.ContainsKey(sum - num)) //avoid collision in mapping the keys in case of repeated values
                d[sum - num] = num;
        }
      
        foreach(int num in a)
        {
            if (d.ContainsKey(num))
                Console.WriteLine("{0} {1}", num, d[num]);
        }
    }
    Misc Engineering & Photography Crew
    Reply With Quote

  19. #349
    Banned johnlynch01's Avatar
    Join Date: Sep 2010
    Posts: 1,117
    Rep Power: 0
    johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250) johnlynch01 has a spectacular aura about. (+250)
    johnlynch01 is offline
    Anyone worked with Alice programming? (srs) It's what they use at my local cc to introduce programming. Should i consider signing up or learn python on my own? (I have some great starter material already to learn python)
    Reply With Quote

  20. #350
    Registered User lems's Avatar
    Join Date: Oct 2007
    Age: 36
    Posts: 1,844
    Rep Power: 0
    lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250) lems has a spectacular aura about. (+250)
    lems is offline
    Originally Posted by Mbalz-Iz-Hari View Post
    1. We're looking for the n-th LAST node. If we're looking at the n-th node, then the problem is trivial.

    2. Hashmap?! I think you're really just implementing an array in your code. No need for the hash function overhead and extra space. Also, you can't index a Hashmap like an array unless you use a Sorted Hashmap/Dictionary, which implements AVL trees underneath the hood, and actually has a different run time compared to a normal Hashmap (albeit not too too significant for a reasonable input size). Only useful if repeated queries are required of the n-th last node, otherwise, this can be solved in-place, which has been posted already.

    3. In your implementation head.val never gets changed. Why would you even need the value? The question is asking a reference to the node itself.



    Code:
    void OutputNumbers(int[] a, int sum)
    {
        Dictionary<int, int> d = new Dictionary<int, int>();
        foreach(int num in a)
        {
            if (!d.ContainsKey(sum - num)) //avoid collision in mapping the keys in case of repeated values
                d[sum - num] = num;
        }
      
        foreach(int num in a)
        {
            if (d.ContainsKey(num))
                Console.WriteLine("{0} {1}", num, d[num]);
        }
    }
    LOL you are right, I dunno why I didn't just use an array. Interesting note about the avl tree thing. it made me realize I'm not even sure how hashmaps implement their data structures under the hood.

    anyways, here's another go before class:
    Code:
    function(head, num){
    int count = 0;
    while((head.length - num) > count){
      head = head.next
      count++;
    }
    return head
    }
    so my thinking is this:

    linkedlist = 12 nodes. 3 from the last node is node 9 (11, 10, 9.. this is how I'm reasoning Nth from the last)

    so head.length = 12. so 12 - 3 = 9. Then I just traverse the linked list until I reach the 9th node which is 3 form the last. There's prob errors somewhere, but I'm off to school now. Will appreciate comments.

    Also, in your implementation of my algo problem, you could have use just 1 loop. you can check for the existance of the number you need as you are building the index. I can explain when I get back tonight if you don't get what I mean.
    Reply With Quote

  21. #351
    The voice of reason. Mbalz-Iz-Hari's Avatar
    Join Date: Dec 2009
    Location: Toronto, Ontario, Canada
    Posts: 454
    Rep Power: 289
    Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50) Mbalz-Iz-Hari will become famous soon enough. (+50)
    Mbalz-Iz-Hari is offline
    Originally Posted by lems View Post
    Also, in your implementation of my algo problem, you could have use just 1 loop. you can check for the existance of the number you need as you are building the index. I can explain when I get back tonight if you don't get what I mean.
    True, but it's still the same number of operations even if it's two loops.
    Misc Engineering & Photography Crew
    Reply With Quote

  22. #352
    Registered User GODLE's Avatar
    Join Date: Dec 2008
    Location: Arizona, United States
    Age: 34
    Posts: 1,621
    Rep Power: 2134
    GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000) GODLE is just really nice. (+1000)
    GODLE is offline
    /* Convert logical page number to physical frame number.
    @param id the threadID of the requesting thread
    @param pageNumber the page number the thread wants to access
    @return the frameNumber (physical address) of the pageNumber
    (logical address)
    */
    public synchronized int accessMemory(int id, int pageNumber)
    {
    for(int a = 0; a < 1; a++)
    {
    PageTable requestPageNumber = pageTableList.lookup(a);
    requestPageNumber.lookupPageTable(a);
    System.out.println(requestPageNumber);
    }
    return 8;
    }

    I'm stuck here. help please.
    Reply With Quote

  23. #353
    emperor deadforaminute's Avatar
    Join Date: Sep 2006
    Location: Connecticut, United States
    Posts: 2,007
    Rep Power: 1248
    deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000) deadforaminute is just really nice. (+1000)
    deadforaminute is offline
    Originally Posted by johnlynch01 View Post
    Anyone worked with Alice programming? (srs) It's what they use at my local cc to introduce programming. Should i consider signing up or learn python on my own? (I have some great starter material already to learn python)
    alice looks like its for little kids.. never used it though so i wouldn't know.

    python is amazing, used in a large number of areas, scripting web sites via django, scripting video games via blender, desktop applications with gtk/wxpython, video games via pygame. the range of uses for python is huge, the number of tutorials and help on forums is also huge.

    java is much faster than python but the syntax is not as strait forward and harder to understand. python would be your best bet for a starter programming language.

    until you get into complex geometry or long running heavy work load algorithms, your programming language honestly doesn't matter. the basic principles are all the same.
    the whole world makes me lol
    Reply With Quote

  24. #354
    Fcuk You Pay_Me's Avatar
    Join Date: Dec 2007
    Age: 40
    Posts: 7,498
    Rep Power: 5191
    Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500)
    Pay_Me is offline
    Originally Posted by Boatski View Post
    http://usesthis.com/archives/ cool website to read about what other devs use, etc.
    You sir, deserve reps for this link.
    This is our world now...the world of the electron and the switch, the beauty of the baud.

    "A dollar doesn't seem like much till its your last one." - skinny buckeye
    Reply With Quote

  25. #355
    Resident Liberal Elite NeoKantian's Avatar
    Join Date: Jan 2011
    Posts: 4,920
    Rep Power: 58332
    NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000) NeoKantian has much to be proud of. One of the best! (+20000)
    NeoKantian is offline
    Anyone know how to do this in c++?
    -Write a function that takes an ifstream variable and returns the number of integers in the file

    EDIT: Figured it out.
    Last edited by NeoKantian; 04-29-2011 at 03:39 PM.
    Reply With Quote

  26. #356
    ♦ ɴɣϲ ϲrew ♦ Phenom01's Avatar
    Join Date: Jul 2005
    Location: Manhattan, New York
    Age: 35
    Posts: 4,986
    Rep Power: 5083
    Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500) Phenom01 is a glorious beacon of knowledge. (+2500)
    Phenom01 is offline
    Originally Posted by NeoKantian View Post
    Anyone know how to do this in c++?
    -Write a function that takes an ifstream variable and returns the number of integers in the file

    EDIT: Figured it out.
    what????
    ****************************
    * MISC IT expert *
    * Ron Paul for president!! *
    ****************************
    Reply With Quote

  27. #357
    _ samh16's Avatar
    Join Date: Nov 2008
    Posts: 423
    Rep Power: 5166
    samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500) samh16 is a glorious beacon of knowledge. (+2500)
    samh16 is offline
    Bump.

    I've been playing around with python for the last few days instead of studying. It's a nice change from MIPS.
    Been using Tkinter for GUI stuff so far, it's really easy to use but there's a ton of other libraries for UI's out there. Anybody got any first hand experience/opinions on other toolkits
    for python?

    Reps for good answers.
    Rep back 3k+
    Reply With Quote

  28. #358
    Registered User GoJackets89's Avatar
    Join Date: May 2008
    Location: Kentucky, United States
    Age: 34
    Posts: 2,855
    Rep Power: 0
    GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500)
    GoJackets89 is offline
    Hey guys, just wondering what good Java programming books are out there. I have an intro to java programming book, but it's a text book for my class i took and 'm looking for something a little less like a textbook. I'm also taking a C# course when summer semester starts, so if there are any good books for that let me know as well. thanks in advanced.
    Reply With Quote

  29. #359
    Fcuk You Pay_Me's Avatar
    Join Date: Dec 2007
    Age: 40
    Posts: 7,498
    Rep Power: 5191
    Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500) Pay_Me is a glorious beacon of knowledge. (+2500)
    Pay_Me is offline
    Originally Posted by GoJackets89 View Post
    Hey guys, just wondering what good Java programming books are out there. I have an intro to java programming book, but it's a text book for my class i took and 'm looking for something a little less like a textbook. I'm also taking a C# course when summer semester starts, so if there are any good books for that let me know as well. thanks in advanced.
    Do both of those languages really interest you? Or just learning for school?
    This is our world now...the world of the electron and the switch, the beauty of the baud.

    "A dollar doesn't seem like much till its your last one." - skinny buckeye
    Reply With Quote

  30. #360
    Registered User GoJackets89's Avatar
    Join Date: May 2008
    Location: Kentucky, United States
    Age: 34
    Posts: 2,855
    Rep Power: 0
    GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500) GoJackets89 is a jewel in the rough. (+500)
    GoJackets89 is offline
    Originally Posted by Pay_Me View Post
    Do both of those languages really interest you? Or just learning for school?
    Java does, but that's mainly because it's the only one 've been exposed to thus far. Both are required for my degree. Still have to take the 2nd part of Java programming in the fall.
    Reply With Quote

Similar Threads

  1. Replies: 0
    Last Post: 04-14-2010, 11:34 PM
  2. Elbow Tendinitis.. what the hell man!! Help Wanted
    By TooSharp in forum Workout Programs
    Replies: 9
    Last Post: 11-02-2009, 01:46 PM
  3. Learning the POWER CLEAN: Help Wanted [Video Inside]
    By Dracoy in forum Powerlifting/Strongman
    Replies: 22
    Last Post: 05-24-2009, 04:48 AM
  4. About the german volume training...help wanted
    By master_no_name in forum Workout Programs
    Replies: 4
    Last Post: 01-12-2003, 06:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts