Search Results

Search found 42 results on 2 pages for 'codenotguru'.

Page 1/2 | 1 2  | Next Page >

  • Finding anagaram(s) of dictionary words

    - by Codenotguru
    How can I take an input word (or sequence of letters) and output a word from a dictionary that contains exactly those letters? Does java has an English dictionary class (list of words) that I can use, or are there open source implementations of this? How can I optimize my code if this needs to be done repeatedly?

    Read the article

  • posix pthreads in c

    - by Codenotguru
    Iam new to c programming and needs some help. long *taskids[NUM_THREADS]; for(t=0; t<NUM_THREADS; t++) { taskids[t] = (long *) malloc(sizeof(long)); *taskids[t] = t; printf("Creating thread %ld\n", t); rc = pthread_create(&threads[t], NULL, PrintHello, (void *) taskids[t]); ... } This code fragment demonstrates how to pass a simple integer to each thread. The calling thread uses a unique data structure for each thread, insuring that each thread's argument remains intact throughout the program. Iam not able to understand how this is happening can somebody explain it??

    Read the article

  • n elements in singly linked list

    - by Codenotguru
    The following function is trying to find the nth to last element of a singly linked list. for ex: if the elements are 8-10-5-7-2-1-5-4-10-10 then the result is 7th to last node is 7. Can anybody help me on how this code is working or is there a better and simpler approach? LinkedListNode nthToLast(LinkedListNode head, int n) { if (head == null || n < 1) { return null; } LinkedListNode p1 = head; LinkedListNode p2 = head; for (int j = 0; j < n - 1; ++j) { // skip n-1 steps ahead if (p2 == null) { return null; // not found since list size < n } p2 = p2.next; } while (p2.next != null) { p1 = p1.next; p2 = p2.next; } return p1; }

    Read the article

  • hashmap in java

    - by Codenotguru
    i have a hashmap where every key has many values(stored in a arraylist). How to display the arraylist i.e the values for a particular key in a hashmap in java??

    Read the article

  • pointer reference type

    - by Codenotguru
    I am trying to write a function that takes a pointer argument, modifies what the pointer points to, and then returns the destination of the pointer as a reference. I am gettin the following error: cannot convert int***' toint*' in return| Code: #include <iostream> using namespace std; int* increment(int** i) { i++; return &i;} int main() { int a=24; int *p=&a; int *p2; p2=increment(&p); cout<<p2; } Thanks for helping!

    Read the article

  • Reservoir sampling

    - by Codenotguru
    to retrieve k random numbers from an array of undetermined size we use a technique called reservoir sampling. Can anybody briefly highlight how it happens with a sample code??

    Read the article

  • How to find nth element from the end of a singly linked list?

    - by Codenotguru
    The following function is trying to find the nth to last element of a singly linked list. For example: If the elements are 8->10->5->7->2->1->5->4->10->10 then the result is 7th to last node is 7. Can anybody help me on how this code is working or is there a better and simpler approach? LinkedListNode nthToLast(LinkedListNode head, int n) { if (head == null || n < 1) { return null; } LinkedListNode p1 = head; LinkedListNode p2 = head; for (int j = 0; j < n - 1; ++j) { // skip n-1 steps ahead if (p2 == null) { return null; // not found since list size < n } p2 = p2.next; } while (p2.next != null) { p1 = p1.next; p2 = p2.next; } return p1; }

    Read the article

  • java interfaces

    - by Codenotguru
    write an interface with one method,two classes that implement the interface, and a main method with an array holding an instance from both classes.Using this array variable call the method in a foreach loop.This is a interview question in java anybody?

    Read the article

  • junit mock objects

    - by Codenotguru
    i am new to junit so any help is appreciated. I have a class called sysconfig.java for which i have written a junit class file called TestSysconfig.java that tests some methods in the sysconfig.java. The method that i am testing in sysconfig.java calls another class file "ethipmapping.java" i have created a mock of this class file as Testethipmapping.java. so my question is how do i tell sysconfig.java to call this mock object?

    Read the article

1 2  | Next Page >