# Politechnika Śląska - strona 313

## Removing an element

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 490

Removing an element  The element x is to be removed  If x is a leaf, simply remove x  If x has only one subtree, replace x with the subtree  If x has both subtrees, find the successor of x and move it to the place of x ...

## Searching for an element in BST

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 7
Wyświetleń: 399

Searching for an element in BST  Set the current node to the root  If the current node is NULL, the element does not occur in BST.  If found, break.  Otherwise, compare the key you are looking for with the key of the current node.  If less, search in the left subtree  Otherwise, search in rig...

## Searching for the successor

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 392

Searching for the successor  succ(17) = 19  How to find this node...  Go up ”to the right” or  Return the minimum of the found subtree struct bstel* succ(struct bstel *node) { bn* y; if (!node) return NULL; /* error */ if (node-right) return min(node-right); y = parent(node); /* not implemented...

## Strlen

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 644

Strlen  size_t strlen(const char *s);  Returns the number of characters in s, not counting the terminating null character #include #include int main() { char *string = "The ANSI C compiler"; printf("%d\n", strlen(string)); r...

## Binary Search Tree

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 343

Binary Search Tree (BST)  A special kind of a binary tree  Each element contains a (unique) key  Keys should be linearly orderable  All elements in the left subtree have less keys than the key of the parent  All elements in the right subtree have greater keys than the key of the parent ...

## Examples of dynamic data structures

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 371

Examples of dynamic data structures  A singly-linked list may be created in any language supporting dynamic memory allocation  Algorithms presented here apply to other languages too  … of course, after translating  Another example: a BST for storing and searching for records in an efficient way...

## Functions operating on strings

• Politechnika Śląska
• dr inż. Piotr Fabian
• Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 329

Functions operating on strings  Header file:  In C++: use  All functions assume, than strings are terminated by a '\0'  Most functions don't allocate memory for strings  The user is responsible for providing a buffer long enough for the result ...

## Algorithms for system synthesis and optimization

• Politechnika Śląska
• dr inż. Piotr Czekalski
• Theory of Logic Circuits
Pobrań: 0
Wyświetleń: 504

Algorithms for system synthesis and optimization There are many CAD methods helping Circuit developer do their job faster and better. During this labs you will test two methods: 1. A Table of Switching Sequence method for synthesis of sequential...

## Realizacja funkcji z MUX i DMUX

• Politechnika Śląska
• dr inż. Piotr Czekalski
Pobrań: 14
Wyświetleń: 399

Implementation of functions with MUX and DMUX Optimal realization with DMUX and MUX elements is not a trivial task. Available software allows for such implementation as long as a function to be connected meets the constraints as to the number ...

## Funkcje wykonawcze Logic. Korzystanie multiplekserów i demultiplekseró...

• Politechnika Śląska
• dr inż. Piotr Czekalski
• Theory of Logic Circuits
Pobrań: 21
Wyświetleń: 392

Implementing Logic Functions Using Demultipllexers and Multiplexers A type 2 (and higher) MUX design requires two or more signal to be partitioned off. Using this signals are created set of functions which are connected to input lines of Multiplexer. Example below presents this problem and its so...