CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: SlickHawk

Search: Search took 0.10 seconds.

  1. Replies
    1
    Views
    1,713

    Re: Height of weighted tree

    Well, normally, to find the depth of a tree, we do something like this:



    int GetDepth(Node * node)
    {
    //this example doesn't take into account trees with just one child
    //but that's...
  2. Re: create doubly linked list with .txt file contents read each line as string

    That's a big problem. That assignment is simply copying the pointer to the string, which, as we can find by travelling up the stack, is just data's value. That array is getting overwritten every...
  3. Re: Is there an algorithm to compress based on repeating substrings?

    What you're looking for is a dictionary-based encoding scheme. The word "dictionary" alone should provide you ample avenues if you search, but "LZW" might be a good starting place.
  4. Re: How to code a math formula and passing it to a function

    I'm not quite sure what you're asking. If it's about C++ syntax for referencing functions, this isn't really the forum for that, but whatever.

    So, from what I've gathered, you need to make your...
  5. Re: Need help recognizing color blend algorithm

    Edit: Ah, wait, I think I just now understood.

    Actually, it may be a conversion to HSV and back for each iteration. I'm not sure the properties of something like that, but it seems likely.
  6. Replies
    2
    Views
    2,396

    Re: Group Selecting

    In order to start thinking about an algorithm, we'd need some more information.

    Is the cost of splitting the same no matter what? For example...

    Cost(splitting 10 into 5,5) == Cost(splitting...
  7. Replies
    2
    Views
    845

    Re: tree traversals

    If you have preorder and inorder, you should be able to do postorder. They're just swapping the orders in which you do things.

    preorder:

    1. visit node
    2. preorder(node.left)
    3....
  8. Replies
    1
    Views
    5,152

    Re: BFS & DFS Algorithm

    From what I can see, your BFS looks correct.

    The difference between a BFS and a DFS is very minimal. A BFS algorithm looks something like this:

    1. Place the starting node on a list.
    2. If the...
  9. Replies
    1
    Views
    906

    Re: data srtructire-Tree traversal

    For a valid binary tree, an in-order traversal will always result in a strictly non-descending order, so yours is correct.

    In a postorder traversal, you visit both your children before you visit...
  10. Re: A problem about Longest Increasing Subsequence

    Ah, I see what the problem is then. I realize I was incorrect before, there may be several unique subsequences of length L. For example,

    1, 3, 2, 5

    (1, 2, 5) and (1, 3, 5) are both valid...
  11. Re: A problem about Longest Increasing Subsequence

    Well, if you have an algorithm to find the longest increasing subsequence (which is already O(n*lg(n))), and it turns out that the size of the subsequence returned is >= L, then any possible...
  12. Replies
    3
    Views
    13,248

    Re: algorithm for polynomial multiplication

    We need more information than that. What do you mean, "in linked lists"? Does each node contain information about a different degree in the polynomial? Are you guaranteed the variable is always...
  13. Replies
    6
    Views
    1,164

    Re: shortest path

    Ah, you're right. So, to rectify, any time C is a destination, that may also fill one of the required "source" C's, meaning that a node X should appear in the list max(source X's, dest X's) times. ...
  14. Replies
    6
    Views
    1,164

    Re: shortest path

    Could you explain how they're not equivalent problems? That's not meant to be snide; I'd truly like to know.

    To me, just thinking about it, it's just TSP on a subset of G, where G is the initial...
  15. Replies
    3
    Views
    1,108

    Re: Shortest route

    Run Dijkstra's from A->D->F->H.
    And then again from A->F->D->H.

    See which one has a smaller cost.
  16. Re: skipping to a specific place in a recursive function

    I'm having trouble understanding exactly what you want to achieve here. Do you think you could list the logical sequence of events you're aiming for? Then I might be able to help you.
  17. Replies
    6
    Views
    1,164

    Re: shortest path

    That's the Travelling Salesman problem, which is NP-Complete. You won't find a non-probabilistic algorithm that's better than O(k^N) because none has been found.
  18. Replies
    4
    Views
    9,058

    Re: C++: Convert Jumple Word to Possible Words

    Off the top of my head...

    Rework your dictionary such that each word is keyed by its spelling in alphabetical order. That is:

    APPLE becomes AELPP
    BRILLIANT becomes ABIILLNRT

    Then you...
  19. Replies
    0
    Views
    1,397

    Fibonacci Heaps

    I'm trying to implement a fibonacci heap, and I'm running into some troubles when trying to implement delete_node.

    When implementing delete_min, I was assured that the size of the array necessary...
Results 1 to 19 of 19





Click Here to Expand Forum to Full Width

Featured