Edited, memorised or added to reading queue

on 02-Nov-2018 (Fri)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Flashcard 3147840752908

Question
Command to mount a new drive (once mount point directory is created is: [...]
Answer
sudo mount /dev/NAME_OF_DRIVE /mnt/NAME_OF_MOUNT_POINT_FOLDER
NOTE: NAME_OF_DRIVE is derived from "fdisk -l"

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill






Flashcard 3510285765900

Question
In Linux, often you cannot easily spoof email addresses via Telnet (using SMTP communcation protocal) as the [...] on the receiving machine has been configured to only accept message from specific trusted machines (or has been configured with similar security percautions).
Answer
mail daemon / mail server / MTA (mail transfer agent)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
10. Mail
In this example, the Subject: is the only header field, although I needn't have supplied a header at all. Now, you may have tried this and gotten a rude error message. This might be because the <span>MTA is configured not to relay mail except from specific trusted machines--say, only those machines within that organization. In this way anonymous email is prevented. On the other hand, if you are connecting to the user's very own mail server, it has to nece







Flashcard 3511625321740

Question
In algorithms, for BinarySearchTree, the delete method (def delete(self, data): ) has these 5 steps: 1) use helper function to get pointers to node to delete and its parent 2) get children count of node to delete 3) If node to delete has no children, see if its right or left child of parent and act accordingly (cover root case where node is root so set root to None!) 4) If node to delete has one child, get pointer to that child (next_node), and if parent exists (i.e. not root case!), make parent point correctly (via left/right pointer) to that child, then cover root case (i.e. make root the next_node) 5) If node to delete has 2 children, create two new pointers, parent_of_leftmost_node (inititialized to node), and leftmost_node (initialized to node.right_child), [...] , and delete the leftmost_node via its parent by pointing its left child to leftmost_node right child (which could be None, if no right child), making sure to cover the basecase where the parent_of_leftmost_node is the root node (which causes right_child pointer of parent to point to leftmost_node right_child)
class Node:        
    def __init__(self, data):            
        self.data = data
        self.left_child = None
        self.right_child = None


class Tree:        
    def __init__(self):            
        self.root_node = None

    def get_node_with_parent(self, data):        
        parent = None        
        current = self.root_node        
        if current == None:            
            return (parent, None)
        while current:            
            if data == current.data:                
                return (parent, current)           
            elif data <= current.data:                
                parent = current                
                current = current.left_child            
            else:                
                parent = current                
                current = current.right_child        
        return (parent, current)


    def remove(self, data): 
        # 1. User helper function to get pointers to node to delete and its parent       
        parent, node = self.get_node_with_parent(data)

        if node == None:            
            return False        

        # 2. Get children count of node to delete       
        children_count = 0        
        if node.left_child and node.right_child:            
            children_count = 2        
        elif (node.left_child is None) and (node.right_child is None):            
            children_count = 0        
        else:            
            children_count = 1

        # 3. If node to delete has no children, see if its right or left child of parent and act accordingly (cover case of root/   

        #   no parent!)
        if children_count == 0:
            if parent:                
                if parent.right_child is node:                    
                    parent.right_child = None
                else:
                    parent.left_child = None
            else:
                self.root_node = None
        # 4. If node to delete has one child, get pointer to that child (next_node), and if parent exists (i.e. not root case!), 
        #    make parent point correctly (via left/right pointer) to that child, then cover root case (i.e. make root the           

        #    next_node)
        elif children_count == 1:
            next_node = None
            if node.left_child:
                next_node = node.left_child
            else:
                next_node = node.right_child
            if parent:
                if parent.left_child is node:
                    parent.left_child = next_node
                else:
                    parent.right_child = next_node
            else:
           
...
Answer
and iterate left on the leftmost_node till you find left most, then swap the current node.data with the leftmost_node.data:
        else:
            parent_of_leftmost_node = node
            leftmost_node = node.right_child
            while leftmost_node.left_child:                ##<<<<<<<<<<<<<<<<<<<<<<<<
                parent_of_leftmost_node = leftmost_node    ##<<<<<<<<<<<<<<<<<<<<<<<<
                leftmost_node = leftmost_node.left_child   ##<<<<<<<<<<<<<<<<<<<<<<<<
            node.data = leftmost_node.data   ##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

            if parent_of_leftmost_node.left_child == leftmost_node:
                parent_of_leftmost_node.left_child = leftmost_node.right_child
            else:  ############ parent_of_leftmost_node is root!!                                  
                parent_of_leftmost_node.right_child = leftmost_node.right_child  

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511629253900

Question
In algorithms, for BinarySearchTree, the delete method (def delete(self, data): ) has these 5 steps: 1) use helper function to get pointers to node to delete and its parent 2) get children count of node to delete 3) If node to delete has no children, see if its right or left child of parent and act accordingly (cover root case where node is root so set root to None!) 4) If node to delete has one child, get pointer to that child (next_node), and if parent exists (i.e. not root case!), make parent point correctly (via left/right pointer) to that child, then cover root case (i.e. make root the next_node) 5) If node to delete has 2 children, create two new pointers, parent_of_leftmost_node (inititialized to node), and leftmost_node (initialized to node.right_child), and iterate left on the leftmost_node till you find left most, then swap the current node.data with the leftmost_node.data, [...]
class Node:        
    def __init__(self, data):            
        self.data = data
        self.left_child = None
        self.right_child = None


class Tree:        
    def __init__(self):            
        self.root_node = None

    def get_node_with_parent(self, data):        
        parent = None        
        current = self.root_node        
        if current == None:            
            return (parent, None)
        while current:            
            if data == current.data:                
                return (parent, current)           
            elif data <= current.data:                
                parent = current                
                current = current.left_child            
            else:                
                parent = current                
                current = current.right_child        
        return (parent, current)


    def remove(self, data): 
        # 1. User helper function to get pointers to node to delete and its parent       
        parent, node = self.get_node_with_parent(data)

        if node == None:            
            return False        

        # 2. Get children count of node to delete       
        children_count = 0        
        if node.left_child and node.right_child:            
            children_count = 2        
        elif (node.left_child is None) and (node.right_child is None):            
            children_count = 0        
        else:            
            children_count = 1

        # 3. If node to delete has no children, see if its right or left child of parent and act accordingly (cover case of root/   

        #   no parent!)
        if children_count == 0:
            if parent:                
                if parent.right_child is node:                    
                    parent.right_child = None
                else:
                    parent.left_child = None
            else:
                self.root_node = None
        # 4. If node to delete has one child, get pointer to that child (next_node), and if parent exists (i.e. not root case!), 
        #    make parent point correctly (via left/right pointer) to that child, then cover root case (i.e. make root the           

        #    next_node)
        elif children_count == 1:
            next_node = None
            if node.left_child:
                next_node = node.left_child
            else:
                next_node = node.right_child
            if parent:
                if parent.left_child is node:
                    parent.left_child = next_node
                else:
                    parent.right_child = next_node
            else:
                self.root_node = next_node
        # 5. If node to delete has 2 children,  create two new pointers, parent_of_leftmost_node (inititialized to node),
        # and leftmost_node (in
...
Answer
and delete the leftmost_node via its parent by pointing its left child to leftmost_node right child (which could be None, if no children), making sure to cover the base case where the parent_of_leftmost_node is the root node (which causes right_child pointer of parent to point to leftmost_node right_child):
        else:
            parent_of_leftmost_node = node
            leftmost_node = node.right_child
            while leftmost_node.left_child:
                parent_of_leftmost_node = leftmost_node
                leftmost_node = leftmost_node.left_child
            node.data = leftmost_node.data

            if parent_of_leftmost_node.left_child == leftmost_node:             ##<<<<<<<<<<<<<<<
                parent_of_leftmost_node.left_child = leftmost_node.right_child  ##<<<<<<<<<<<<<<<
            else:  ############ parent_of_leftmost_node is root!!               ##<<<<<<<<<<<<<<<                                
                parent_of_leftmost_node.right_child = leftmost_node.right_child ##<<<<<<<<<<<<<<<


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511633186060

Question
In algorithms, for BinarySearchTree, for the delete method (def delete(self, data): ), case where the node to delete has 2 children, you need to [...long description...]
Answer
find the leftmost node on the right subtree and copy its value to node to delete, then delete the left most node (that is why you need pointer to left most node and its parent)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511637118220

Question
In algorithms, for BinarySearchTree, for the delete method (def delete(self, data): ), case where the node to delete has 2 children, you need to find the leftmost node on the right subtree and copy its value to node to delete, then delete the left most node, that is why you need pointers to [...] and its [...]
Answer
left most node and its parent

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511640263948

Question
In algorithms, for Binary Search Trees, both insert and delete are of time complexity [...]
Answer
O(h), where h is height of tree
^^ reason is for both insert and delete you need to parse all the way down to bottom of tree.

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511643409676

Question
In algorithms, for BinarySearchTree, the search method (returning True/False if particular data is found in BST), is very similar in approach to the [...] method.
Answer
insert

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511646555404

Question

In algorithms/python, implement the search method below for BinarySearchTree class:

class Node:        
    def __init__(self, data):            
        self.data = data
        self.left_child = None
        self.right_child = None


class BinarySearchTree:        
    def __init__(self):            
        self.root_node = None
...
...

    # method returns True if data found, False otherwise
    def search(self, data):
        #### IMPLEMENT THE BODY OF THIS METHOD #########

Answer
    # method returns True if data found, False otherwise
    def search(self, data):
        current = self.root_node
        while current:
            if data == current.data:
                return True
            elif data < current.data:
                current = current.left_child
            else:
                current = current.right_child
        return False

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511672769804

Question
Sd cholérique : sécrétio
Answer
[default - edit me]

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3511673818380

Question
Agents pathogènes : ● Syndrome cholériforme : → Virus (+++) : NOROVIRUS, ROTAVIRUS (< 5 ans), ADENOVIRUS, ENTEROVIRUS. → Bactéries : S. AUREUS, BACILLUS CEREUS, CLOSTRIDIUM PERFRINGENS, E. COLI entérotoxinogènes (voyage), VIBRIO CHOLERAE (catastrophe sanitaire). ● Syndrome dysentérique ou gastroentéritique : → Bactéries : SHIGELLA, E. COLI (entéro-hémorragique, entéro-aggrégatif, entéro- pathogène), SALMONELLA non typhi, CAMPYLOBACTER JEJUNI, YERSINA SP, CLOSTRIDIUM DIFFICILE (post-ABT). → Parasites : ENTAMOEBA HISTOLYTICA (voyage).
Answer
[default - edit me]

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs