Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class node<T>
- {
- private T Value;
- private node<T> next;
- public node(T X)
- {
- this.Value = X;
- this.next = null;
- }
- public node(T X, node<T> next)
- {
- this.Value = X;
- this.next = next;
- }
- public T GetValue()
- {
- return this.Value;
- }
- public node<T> GetNext()
- {
- return this.next;
- }
- public void SetValue(T x)
- {
- this.Value = x;
- }
- public void SetNext(node<T> next)
- {
- this.next = next;
- }
- public bool HasNext()
- {
- if (this.next == null)
- {
- return false;
- }
- return true;
- }
- public override string ToString()
- {
- return "(the value is " + this.Value + ")";
- }
- }
- class BiNode <T>
- {
- private T Value;
- private BiNode<T> Right;
- private BiNode<T> Left;
- public BiNode(T Value)
- {
- this.Value = Value;
- }
- public BiNode(T Value, BiNode<T> Right, BiNode<T> Left)
- {
- this.Value = Value;
- this.Right = Right;
- this.Left = Left;
- }
- public T GetValue ()
- {
- return Value;
- }
- public void SetValue(T Value)
- {
- this.Value = Value;
- }
- public BiNode<T> GetRight()
- {
- return Right;
- }
- public BiNode<T> GetLeft()
- {
- return Left;
- }
- public void SetLeft(BiNode<T> Left)
- {
- this.Left = Left;
- }
- public void SetRight(BiNode<T> Right)
- {
- this.Right = Right;
- }
- public bool HasRight()
- {
- if (this.Right == null)
- return false;
- return true;
- }
- public bool HasLeft()
- {
- if (this.Left == null)
- return false;
- return true;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement